繁体   English   中英

NativeScript - 使用 iBeacon 重新启动应用程序,AppDelegate 必须实现 window 属性

[英]NativeScript - Restart app using iBeacon, AppDelegate must implement window property

我正在开发与 BLE 设备通信的 NativeScript 应用程序,我需要使用信标重新启动应用程序。

我创建了一个 nativescript 插件,以使用以本机代码 (swift) 实现的自定义 BLE SDK,在 SDK 中使用 startMonitoring(region) 方法,但应用程序适用于 longeground/background我收到此错误:

“如果要使用主 storyboard 文件,应用程序委托必须实现 window 属性。”

我尝试使用 window 属性在 NativeScript 中添加自定义 AppDelegate,但没有任何改变,这是我的 CustomAppDelegate:

export class CustomAppDelegate extends UIResponder implements UIApplicationDelegate {
    public static ObjCProtocols = [UIApplicationDelegate];
    window:UIWindow;

    applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<string, any>): boolean {
        console.log("applicationWillFinishLaunchingWithOptions: " + launchOptions)

        return true;
    }

    applicationDidBecomeActive(application: UIApplication): void {
        console.log("applicationDidBecomeActive: " + application)
    }
}

if (platform.isIOS) {
    ios.delegate = CustomAppDelegate;
}

试试吸气剂,

export class CustomAppDelegate extends UIResponder implements UIApplicationDelegate {
    ....

    get window() {
       return undefined;
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM