2016-08-19 12 views
0

私のアプリはAndroid上で完璧に動作します。しかし、実際のiOSデバイスでテストすると、デバイスを登録してデバイストークンを取得できません。ここに私のコードは次のとおりです。iOSで起動しなくても電話の隙間の登録

.run(function($ionicPlatform, $rootScope) { 
 
    $ionicPlatform.ready(function() { 
 
    if(window.cordova && window.cordova.plugins.Keyboard) { 
 
     // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard 
 
     // for form inputs) 
 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
 

 
     // Don't remove this line unless you know what you are doing. It stops the viewport 
 
     // from snapping when text inputs are focused. Ionic handles this internally for 
 
     // a much nicer keyboard experience. 
 
     cordova.plugins.Keyboard.disableScroll(true); 
 
    } 
 
    if(window.StatusBar) { 
 
     StatusBar.styleDefault(); 
 
    } 
 
    var push = PushNotification.init({ 
 
     android: { 
 
      senderID: "411587591993" 
 
     }, 
 
     browser: { 
 
      pushServiceURL: 'http://push.api.phonegap.com/v1/push' 
 
     }, 
 
     ios: { 
 
      alert: "true", 
 
      badge: "true", 
 
      sound: "true" 
 
     }, 
 
     windows: {} 
 
    }); 
 
     push.on('registration', function(data) { 
 
      console.log("Device Token: " + data.registrationId); 
 
      $rootScope.devToken = data.registrationId; 
 
     }) 
 
     push.on('notification', function(data) { 
 
      if (data.additionalData.foreground) { 
 
      alert(data.message); 
 
      } 
 
     }) 
 
    }); 
 
})

誰もがpush.on(「登録」)でも、私のIDを取得するために私のデバイスを登録しませんなぜ私が把握助けることができますか?任意の助けをいただければ幸いです

2016-08-19 15:43:27.474 pushNotify[930:236258] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/91498E22-6A53-405A-9497-B0EC644365B2/Library/Cookies/Cookies.binarycookies 
 
2016-08-19 15:43:27.566 pushNotify[930:236258] Apache Cordova native platform version 4.1.0 is starting. 
 
2016-08-19 15:43:27.567 pushNotify[930:236258] Multi-tasking -> Device: YES, App: YES 
 
2016-08-19 15:43:27.622 pushNotify[930:236258] Using UIWebView 
 
2016-08-19 15:43:27.625 pushNotify[930:236258] [CDVTimer][handleopenurl] 0.119984ms 
 
2016-08-19 15:43:27.626 pushNotify[930:236258] [CDVTimer][intentandnavigationfilter] 1.450002ms 
 
2016-08-19 15:43:27.626 pushNotify[930:236258] [CDVTimer][gesturehandler] 0.083029ms 
 
2016-08-19 15:43:27.626 pushNotify[930:236258] CDVPlugin class CDVSplashScreen (pluginName: splashscreen) does not exist. 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] [CDVTimer][splashscreen] 0.093997ms 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] CDVPlugin class CDVStatusBar (pluginName: statusbar) does not exist. 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] [CDVTimer][statusbar] 0.087023ms 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] CDVPlugin class IonicKeyboard (pluginName: keyboard) does not exist. 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] [CDVTimer][keyboard] 0.083983ms 
 
2016-08-19 15:43:27.627 pushNotify[930:236258] [CDVTimer][TotalPluginStartup] 2.694964ms 
 
2016-08-19 15:43:27.761 pushNotify[930:236258] createNotificationChecker 
 
2016-08-19 15:43:27.762 pushNotify[930:236258] not coldstart 
 
2016-08-19 15:43:27.763 pushNotify[930:236258] active 
 
2016-08-19 15:43:27.764 pushNotify[930:236258] PushPlugin skip clear badge 
 
2016-08-19 15:43:28.001 pushNotify[930:236258] Resetting plugins due to page load. 
 
2016-08-19 15:43:28.374 pushNotify[930:236258] Finished load of: file:///var/containers/Bundle/Application/E3454A9E-D203-4335-A64F-602C0AE8C181/pushNotify.app/www/index.html 
 
2016-08-19 15:43:28.650 pushNotify[930:236258] CDVPlugin class CDVDevice (pluginName: Device) does not exist. 
 
2016-08-19 15:43:28.650 pushNotify[930:236258] ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 
 
2016-08-19 15:43:28.651 pushNotify[930:236258] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["Device651815033","Device","getDeviceInfo",[]] 
 
2016-08-19 15:43:28.654 pushNotify[930:236258] CDVPlugin class CDVStatusBar (pluginName: StatusBar) does not exist. 
 
2016-08-19 15:43:28.654 pushNotify[930:236258] ERROR: Plugin 'StatusBar' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml. 
 
2016-08-19 15:43:28.654 pushNotify[930:236258] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["StatusBar651815034","StatusBar","_ready",[]]

: はここに私のXcodeのコンソールログです。なぜそれがAndroid上で完璧に動作するのか、iOSでは全く動作しないのか分かりません。前もって感謝します!

+0

受信したエラーを検索しましたか? 'ERROR:Plugin 'Device'が見つかりません。またはCDVPluginではありません。 config.xmlのプラグインマッピングを確認してください.'それを扱っているのでここにいくつかの記事があります。 – Phonolog

答えて

0

私がしなければならなかったのは自分のプラットフォームをアンインストールして再インストールすることでした。 iOSエラーが修正されました。すべて正常に動作します。

関連する問題