export class Mycallback{ callback : ((resp : UTSJSONObject) => void) | null = null onCallback(handle : (resp : any) => void) { this.callback = handle if(MyPluginClass.currentself!=null){ MyPluginClass.currentself.callback = handle; } } } export class MyPluginClass implements UTSiOSHookProxy { // uts 插件创建时的回调。 static currentself : MyPluginClass | null = null callback : ((resp : any) => void) | null = null onCreate(){ } // 应用正常启动时 (不包括已在后台转到前台的情况)的回调函数。 applicationDidFinishLaunchingWithOptions(application: UIApplication | null, launchOptions: Map | null = null): boolean { // console.log("applicationDidFinishLaunchingWithOptions") MyPluginClass.currentself = this; return false } // 远程通知注册成功时的回调函数。(打自定义基座时需要勾选 push 模块) didRegisterForRemoteNotifications(deviceToken: Data | null) { } // 远程通知注册失败时的回调函数。(打自定义基座时需要勾选 push 模块) didFailToRegisterForRemoteNotifications(error: NSError | null) { } // 应用收到远程通知时的回调函数。(打自定义基座时需要勾选 push 模块) didReceiveRemoteNotification(userInfo: Map | null) { // console.log("didReceiveRemoteNotification") this.callback?.(userInfo) } // 应用收到本地通知时的回调函数。(打自定义基座时需要勾选 push 模块) didReceiveLocalNotification(notification: UILocalNotification | null) { // console.log("didReceiveLocalNotification") } // 应用程序的 main 函数。 applicationMain(argc: Int32, argv: UnsafeMutablePointer | null>) { console.log("applicationMain") } }