1***@qq.com
1***@qq.com
  • 发布:2025-07-10 09:42
  • 更新:2025-07-10 14:29
  • 阅读:18

【报Bug】uts原生插件问题:.uts中调用.swift文件方法问题

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: macOS sequoia 15.5

HBuilderX类型: 正式

HBuilderX版本号: 4.66

手机系统: iOS

手机系统版本号: iOS 17

手机厂商: 苹果

手机机型: 模拟器

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

看BUG 描述

预期结果:

能正确调用.swift 文件中的方法

实际结果:

能正确调用.swift 文件中的方法

bug描述:

swift文件中方法:

  open func set(_ value: String, forKey key: String,  
                  withAccess access: KeychainSwiftAccessOptions? = nil) -> Bool {  

    return false  
  }  ```   

我在uts中调用  
 ```        keychain.set(str, @argumentLabel("forKey") key:kKeyChainAccount)  

报错,什么问题,我调用方法错误吗?还是bug

09:14:28.582 项目 uts_chajian 开始编译  
09:14:29.808 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。  
09:14:29.808 编译器版本:4.66(uni-app x)  
09:14:29.808 正在编译中...  
09:14:32.060   x Expected ',', got ':'  
09:14:32.838     at uni_modules/hq-uuid/utssdk/app-ios/index.uts:61:1  
09:14:32.838  58 |     
09:14:32.838  59 |   keychain.set(str, @argumentLabel("forKey") key:kKeyChainAccount)  
09:14:32.838     :                                                 ^  
09:14:32.838  59 |     
09:14:32.838     `----  
09:14:32.838 Caused by:  
09:14:32.838     Syntax Error  
09:14:34.594 [plugin:uts] load_transformed failed  
09:14:34.594 Caused by:  
09:14:34.594     0: Bundler.load() failed  
09:14:34.594     1: Bundler.loader.load(/Users/univalsoft_ios/Downloads/uts_chajian/unpackage/dist/dev/.uvue/app-ios/uni_modules/hq-uuid/utssdk/app-ios/index.uts) failed  
09:14:34.594     2:   
09:14:34.594          x Expression expected  
09:14:34.594            ,-[/Users/univalsoft_ios/Downloads/uts_chajian/unpackage/dist/dev/.uvue/app-ios/uni_modules/hq-uuid/utssdk/app-ios/index.uts:43:1]  
09:14:34.594         43 |     // if (uuidstr == null) {  
09:14:34.594         44 |     let uuid = UIDevice.current.identifierForVendor?.uuidString ?? "";  
09:14:34.594         45 |     let str = uuid.replace(/-/g, '');  
09:14:34.594         46 |     keychain.set(str, , key, kKeyChainAccount);  
09:14:34.594            :                       ^  
09:14:34.594         47 |     uuidstr = str;  
09:14:34.595         48 |     __f__('log', 'at uni_modules/hq-uuid/utssdk/app-ios/index.uts:63', "-----------");  
09:14:34.595         49 |     // }  
09:14:34.595            `----  
09:14:34.595          
09:14:34.595     3: Syntax Error  
09:14:34.595 at uni_modules/hq-uuid:1:0  
2025-07-10 09:42 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

已解决

要回复问题请先登录注册