2016-08-19 81 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? 這是我的Xcode控制檯日誌:

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",[]]

任何幫助,將不勝感激。我無法弄清楚爲什麼它在Android上完美無瑕,在iOS上完全沒有。提前致謝!

+0

您是否搜索了您收到的錯誤? '錯誤:找不到插件'Device',或者不是CDVPlugin。在config.xml中檢查你的插件映射。「這裏有一些關於SO處理它的帖子。 – Phonolog

回答

0

我所要做的就是卸載我的平臺並重新安裝它們。它修復了iOS錯誤。現在一切正常。