2

新しいbms-push cordovaプラグインを使用してIonicテストアプリケーションを実装しました。iOSのbms-push cordovaプラグインは次のようになります:致命的なエラー:予期せぬことにnilをアンラッピングしているときにオプション値

Androidでは問題なく動作します。 iOSのアプリを起動するとき

しかし、それはすぐに失敗します。

fatal error: unexpectedly found nil while unwrapping an Optional value

エラーがCDVBMSPushクラスのdidReceiveRemoteNotificationOnLaunch機能で発生します。

私はAppDelegate.m

[[CDVBMSPush sharedInstance] didReceiveRemoteNotificationOnLaunchWithLaunchOptions:launchOptions];

に次の行をコメントアウトした場合、アプリが正常に起動します。

問題を解決するにはどうしたらよいですか? Thxを

答えて

2

だけでは、サポートチームからanswerを得た:

[[CDVBMSPush sharedInstance] didReceiveRemoteNotificationOnLaunchWithLaunchOptions:launchOptions];

This is only used when app is opened by clicking push notifications.

At the first time launchOptions will be nil. That why its failing.

Solutions:

  1. you can add a check there whether the launchOptions is of type remoteNotificationKey, If yes then add the [[CDVBMSPush sharedInstance] didReceiveRemoteNotificationOnLaunchWithLaunchOptions:launchOptions];

Example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    if (launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) { 
     [[CDVBMSPush sharedInstance] didReceiveRemoteNotificationOnLaunchWithLaunchOptions:launchOptions]; 
    } 
} 
  1. Completely remove that line of code.
+0

は私もこのコード行を指しているのクラッシュを取得しています..しかし、経由で開始した場合にのみ、 TestFlightアプリ。 BMS-Pushのサンプル/セットアップコードは、nilのチェックを含むように少し更新されましたが、私はまだエラーが発生しているので、その行を削除してしまいました。それが動作するかどうかを知らせます。 – TimBrighton

関連する問題