UTS iOS插件

1、UTS插件无法出现

再uniapp x中使用时,必须给这个插件高度和宽度,否则出不来!

swift 复制代码
<uts-hello-view buttonText="点击按钮内容" style="width:375px;height: 375px;background-color: aqua;"></uts-hello-view>

2、无法运行

检查是否都已经Podfile文件中版本修改为12

问题:Sandbox: bash(72928) deny(1) file-write-create

方法:build settings->User Script Sandboxing 修改为NO

3、使用第三方库时,不能在.h文件中导入这个内容第三方库 !!!

4、swift 如果类添加了public前缀,那么无法添加协议MAMapViewDelegate,会报错!!!

5、如何在uts插件中调用swift的方法

首先,swift必须是public 或者open修饰,比如 public class NHT_DemoView

但是高德地图又不能用这个修饰,所以将高德地图添加到一个view上,然后将这个view添加到另一个通过

public修饰的类上,通过这个类调用高德地图的api;

6、如何在UTS插件中使用swift的闭包

swift:

@objc open var SelectLocationChangeBlock: (([String:Any])->Void)?

UTS插件:

swift 复制代码
NVLoad() : NHT_DemoView {
			// -----NHT_AMAPView
			let button = new NHT_DemoView()
			button.SelectLocationChangeBlock = (res : any) => {
				this.$emit('fetchgis', res)
			};
	return button
		},

this.$emit传值报错,error: cannot convert value of type 'String' to expected argument type '[String : Any]?'

因为传值类型不对,可以自己声明一个变量,然后当参数传值

swift 复制代码
const map1 = new Map<string,any>()
			map1.set('a', 'alpha');

或者改变响应回调的写法(必须按照你实际的返回内容),

swift 复制代码
button.SelectLocationChangeBlock = (res : Map<string, any>) => {
				this.$emit('fetchgis', res)
			};

7、不能全用self.bounds,有可能出不来啊!!!!

需要直接写死frame,或者使用约束;

8、error: uni_modules/nhyt-texs/utssdk/app-ios/src/index.swift:61:9: error: contextual closure type '(Any, Any) -> Void' expects 2 arguments, but 1 was used in closure body

可能是watch中出现的问题

比如监听下面的值

"enableLocation": {//允许定位

type: Boolean,

default: false

},

watch: {

//这样写对,必须有newValue : boolean, oldVel : boolean,只有newValue会报这个错误

"enableLocation": {

handler(newValue : boolean, oldVel : boolean) {

// if (!this.isInitLocation && newValue && !this.innerEnableLocation) {

// this.isInitLocation = true

// this.innerEnableLocation = newValue

// this.initLocation()

// }

},

immediate: false

},

}

9、emit

只能全部小写,有大写的不行,比如下面fetchGis就不行,而fetchgis可以

emits: ['fetchGis', "locate", "hhhh", "fetchgis"],

相关推荐
敲代码的鱼哇16 小时前
跳转原生系统设置插件 支持安卓/iOS/鸿蒙UTS组件
android·ios·harmonyos
在下历飞雨17 小时前
Kuikly基础之状态管理与数据绑定:让“孤寡”计数器动起来
ios·harmonyos
在下历飞雨17 小时前
Kuikly基础之Kuikly DSL基础组件实战:构建青蛙主界面
ios·harmonyos
鹏多多.18 小时前
flutter-使用fluttertoast制作丰富的高颜值toast
android·前端·flutter·ios
他们都不看好你,偏偏你最不争气21 小时前
【iOS】多界面传值
ios
MaoJiu2 天前
Flutter混合开发:在iOS工程中嵌入Flutter Module
flutter·ios
2501_915921432 天前
小团队如何高效完成 uni-app iOS 上架,从分工到工具组合的实战经验
android·ios·小程序·uni-app·cocoa·iphone·webview
2501_916008892 天前
uni-app iOS 文件管理与 itools 配合实战,多工具协作的完整流程
android·ios·小程序·https·uni-app·iphone·webview
Digitally2 天前
如何将视频从 iPhone 转移到 Mac
macos·ios·iphone
2501_916007472 天前
uni-app iOS 文件调试常见问题与解决方案:结合 itools、克魔、iMazing 的实战经验
android·ios·小程序·https·uni-app·iphone·webview