0

我怎麼沒有設備令牌?城市飛艇沒有創建設備令牌

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary  *)launchOptions { 

//Create Airship options dictionary and add the required UIApplication launchOptions 
NSMutableDictionary *takeOffOptions = [NSMutableDictionary dictionary]; 
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey]; 

// Call takeOff (which creates the UAirship singleton), passing in the launch options so the 
// library can properly record when the app is launched from a push notification. This call is 
// required. 
// 
// Populate AirshipConfig.plist with your app's info from https://go.urbanairship.com 
[UAirship takeOff:takeOffOptions]; 

// Set the icon badge to zero on startup (optional) 
[[UAPush shared] resetBadge]; 

// Register for remote notfications with the UA Library. This call is required. 
[[UAPush shared] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | 
                UIRemoteNotificationTypeSound | 
                UIRemoteNotificationTypeAlert)]; 

// Handle any incoming incoming push notifications. 
// This will invoke `handleBackgroundNotification` on your UAPushNotificationDelegate. 
[[UAPush shared] handleNotification:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey] 
        applicationState:application.applicationState]; 



    2013-03-19 04:22:44.202 MyApp[1070:907] [D] -[UAPush applicationDidBecomeActive] [Line 555]  Checking registration status after foreground notification 
    2013-03-19 04:22:44.204 MyApp[1070:907] [D] -[UAPush applicationDidBecomeActive] [Line 561]   Checking registration on app foreground disabled on app initialization 
    2013-03-19 04:22:44.241 MyApp[1070:907] [D] -[UAUser listenForDeviceTokenReg] [Line 931] ListenForDeviceTokenReg 
    2013-03-19 04:22:44.270 MyApp[1070:907] [D] -[UAUser userCreated:] [Line 467] User created: 201:{"username": null, "alias": null, "tags": [], "user_id": "xK4v5lARRDCAvekt25TeqA", "user_url": "https://device-api.urbanairship.com/api/user/xK4v5lARRDCAvekt25TeqA/", "device_tokens": [], "password": "oZeZFMO9SpyDZw3lM", "apids": [], "device_pins": [], "ua_device_id": "2A6651E5-6D23-4FAD-B53C-4D6356D7A2AA"} 
    2013-03-19 04:22:44.336 MyApp[1070:907] [D] -[UAUser updateDefaultDeviceToken] [Line 978] Updating device token. 
2013-03-19 04:22:44.338 MyApp[1070:907] [D] -[UAUser updateDefaultDeviceToken] [Line 981] Skipping device token update: no token, already up to date, or user is being updated. 
2013-03-19 04:22:58.766 F 

我在AirshipConfig.plist DEVELOPMENT_APP_SECRET & DEVELOPMENT_APP_KEY以及APP_STORE_OR_AD_HOC = NO

+0

看着他們的代碼https://github.com/urbanairship/ios-library/blob/master/Airship/Common/UAUser.m這裏有一個很大的'if'語句。看看你是否可以找出哪一個失敗..我的猜測是令牌 – govi 2013-03-19 09:53:26

+0

我認爲問題必須在配置的城市Airshiup.Please按照@Akbari Dipali給出的鏈接,並再次按照所有任務。 – Impossible 2013-03-20 04:26:23

回答

1

我認爲,事情是缺少一些步驟,同時配置:

請看https://docs.urbanairship.com/display/DOCS/Getting+Started:+iOS:+Push再次

並嘗試在AppDelegate中記錄您的令牌:

-(void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken 
{ 
NSLog(@"My token is: %@", deviceToken); 
[[UAPush shared] registerDeviceToken:deviceToken]; 
} 

也更新AirshipConfig.plist文件

它可能是錯誤配置的證書/供應配置文件的問題。

+0

我經歷了那個教程,這是我如何得到上面的代碼。我有一個斷點,沒有看到任何令牌。我會添加一個日誌來進一步確保。城市飛艇儀表板上有0個令牌。 – quantumpotato 2013-03-19 19:24:23

+0

這意味着代碼不會被屏蔽 – quantumpotato 2013-03-19 19:25:12

+0

值得注意的是,「registerDeviceToken」對我來說是折舊的。我正在使用庫的1.3.0。另一個問題是,您不能調用庫上的任何方法,直到您首先調用takeOff。如果你使用提供的代理,那麼這將無法工作。我目前正在尋找這樣做的最佳方式。當我找到解決方案時會在這裏發佈。 – Stewart 2013-05-28 03:11:50

0

我有同樣的問題。雖然您有DEVELOPMENT_APP_SECRET & DEVELOPMENT_APP_KEY,但我想UrbanAirship lib期望PRODUCTION_APP_SECRET和PRODUCTION_APP_KEY。當我將它們添加到我的AirshipConfig.plist中時,問題得到解決,我可以通過UrbanAirship發送推送消息。