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发送推送消息。