OStack程序员社区-中国程序员成长平台

标题: ios - Urban Airship Phonegap 插件未在 iOS 应用上注册设备 token [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:58
标题: ios - Urban Airship Phonegap 插件未在 iOS 应用上注册设备 token

我正在使用带有 Urban Airship 插件的 Phonegap 开发一个应用程序。我已经连接并配置了教程中提到的所有内容,但该应用仍未向 UA 注册 token 。

这是我的应用日志:

2013-05-15 18:20:10.791 MyApp[37284:907] Multi-tasking -> Device: YES, App: YES
2013-05-15 18:20:10.917 MyApp[37284:907] [I] +[UAirship takeOff:] [Line 215] App Key: app_key
2013-05-15 18:20:10.918 MyApp[37284:907] [I] +[UAirship takeOff:] [Line 216] App Secret: app_secret
2013-05-15 18:20:10.920 MyApp[37284:907] [I] +[UAirship takeOff:] [Line 217] Server: https://device-api.urbanairship.com
2013-05-15 18:20:10.965 MyApp[37284:907] [D] -[UAirship configureUserAgent] [Line 362] Setting User-Agent for UA requests to MyApp 1.0 (iPhone; iPhone OS 6.1.3; UALib 1.4.0; p3R6RpCWSB2EZ_z9CmbBGg; ru_RU)
2013-05-15 18:20:11.001 MyApp[37284:907] [D] void PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] Reachability Flag Status: -R -----l- networkStatusForFlags
2013-05-15 18:20:11.032 MyApp[37284:907] [D] -[UAUser migrateUser] [Line 168] Migrating User Info: {
     UAUserRecoveryKey = 0;
     UAUserRecoveryKeySent = 0;
     UAUserTagsKey =      (
     );
     UAUserUrlKey = "https://device-api.urbanairship.com/api/user/mRBbpmi2R_SeZad_R2WSxg/";
}
2013-05-15 18:20:11.078 MyApp[37284:907] [D] -[UAUser loadUser] [Line 249] User Info: {
     UAUserRecoveryKey = 0;
     UAUserRecoveryKeySent = 0;
     UAUserTagsKey =      (
     );
     UAUserUrlKey = "https://device-api.urbanairship.com/api/user/mRBbpmi2R_SeZad_R2WSxg/";
}
2013-05-15 18:20:11.087 MyApp[37284:907] [CDVTimer][pushnotificationplugin] 175.806999ms
2013-05-15 18:20:11.091 MyApp[37284:907] [CDVTimer][TotalPluginStartup] 180.313051ms
2013-05-15 18:20:11.263 MyApp[37284:907] [D] -[UAPush applicationDidBecomeActive] [Line 555] Checking registration status after foreground notification
2013-05-15 18:20:11.265 MyApp[37284:907] [D] -[UAPush applicationDidBecomeActive] [Line 561] Checking registration on app foreground disabled on app initialization
2013-05-15 18:20:11.706 MyApp[37284:907] [D] -[UAUser listenForDeviceTokenReg] [Line 931] ListenForDeviceTokenReg
2013-05-15 18:20:11.874 MyApp[37284:907] Resetting plugins due to page load.
2013-05-15 18:20:12.512 MyApp[37284:907] DEPRECATION NOTICE: The Connection ReachableViaWWAN return value of '2g' is deprecated as of Cordova version 2.6.0 and will be changed to 'cellular' in a future release. 
2013-05-15 18:20:13.875 MyApp[37284:907] Finished load of: file:///var/mobile/Applications/F5AA9FE8-7DCD-40A8-825B-8E0F5D12368B/MyApp.app/www/index.html
2013-05-15 18:20:15.489 MyApp[37284:907] [D] -[UAPush updateRegistration] [Line 589] Checking registration state
2013-05-15 18:20:15.506 MyApp[37284:907] [D] -[UAPush updateRegistration] [Line 609] Device token is nil. Registration will be attempted at a later time
2013-05-15 18:20:26.090 MyApp[37284:907] [D] +[UAKeychainUtils getDeviceID] [Line 275] Retrieved device id info from keychain.
2013-05-15 18:20:26.092 MyApp[37284:907] [D] +[UAKeychainUtils getDeviceID] [Line 279] Device ID result is not nil.
2013-05-15 18:20:26.094 MyApp[37284:907] [D] +[UAKeychainUtils getDeviceID] [Line 288] Loaded Device ID: 55ADD1F9-C71E-4604-8EB1-EB9888194468
2013-05-15 18:20:26.095 MyApp[37284:907] [D] +[UAKeychainUtils getDeviceID] [Line 289] Loaded Model Name: iPhone3,1
2013-05-15 18:20:26.477 MyApp[37284:907] [D] -[UAAnalytics requestDidSucceed:response:responseData:] [Line 461] Analytics data sent successfully. Status: 200

我的 index.html 文件中也有 push.enablePush()。我正在使用 Xcode 4.6.2 和 Phonegap 2.7.0。



Best Answer-推荐答案


问题如下:我没有像 iOS 示例中那样做所有事情: https://github.com/urbanairship/phonegap-ua-push/blob/master/ios-sample/www/index.html

我想有一个 registerForNotificationTypes 可以为 iOS 注册通知(Android 没有这种方法)。

所以,通过在代码中添加这一行来解决问题。

关于ios - Urban Airship Phonegap 插件未在 iOS 应用上注册设备 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16567880/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4