2014-03-12 128 views
0

我試圖將Urban Airship整合到我的應用程序中。在UAirship期間發生了一些錯誤 :takeOff。我寫信給FAQ,但沒有人回答我。帶果醬的城市飛艇SDK

我`米使用下面的代碼:

NSLog(@"Starting airship..."); 
UAConfig *config = [UAConfig defaultConfig]; 
config.developmentAppKey = @"mydevelopmentkey"; 
config.developmentAppSecret = @"mydevelopmentsecretkey"; 
config.inProduction = FALSE; 
[UAirship takeOff:config]; 
NSLog(@"Airship started"); 

然後調用起飛方法,應用程序崩潰的時候,我得到了 以下的輸出:

hero[3457] Warning: Starting airship... 
hero[3457] Warning: [W] -[UAConfig validate] [Line 163] Production App Key 
is not valid. 
hero[3457] Warning: [W] -[UAConfig validate] [Line 167] Production App 
Secret is not valid. 
hero[3457] Warning: [I] +[UAirship executeUnsafeTakeOff:] [Line 151] App 
Key: <removed> 
hero[3457] Warning: [I] +[UAirship executeUnsafeTakeOff:] [Line 152] App 
Secret: <removed> 
hero[3457] Warning: [I] +[UAirship executeUnsafeTakeOff:] [Line 153] 
Server: https://device-api.urbanairship.com 
hero[3457] Warning: [D] -[UAirship configureUserAgent] [Line 296] Setting 
User-Agent for UA requests to hero 2.28.11.42.57 (iPod touch; iPhone OS 
6.1.3; UALib 2.1.0; <removed>; ru_RU) 
hero[3457] Warning: [D] void 
PrintReachabilityFlags(SCNetworkReachabilityFlags, const char *) [Line 79] 
Reachability Flag Status: -R -----l- networkStatusForFlags 
hero[3457] Warning: [D] +[UAirship executeUnsafeTakeOff:] [Line 186] 
Deleting the UA device ID 
hero[3457] Error: *** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot 
be nil (key: gena)' 
*** First throw call stack: 
(0x32d792a3 0x3aa5d97f 0x32cdb313 0x4ef85 0x4ee27 0x4f877 0x490b7 0x48aaf 
0x3ae744b7 0x3ae7a3f7 0x48a8b 0x43760 0x43484 0xd95c0 0xe7020 0x336900f5 
0x32d4e683 0x32d4dee9 0x32d4ccb7 0x32cbfebd 0x32cbfd49 0x368872eb 
0x34bd5301 0xead4c 0x2e214) 

我開發使用的Marmalade SDK遊戲。它提供了編寫本機「擴展」(本地代碼庫,可以從C++代碼調用)的功能。問題是,該擴展程序不能被處理。 我嘗試從主線程調用上面的代碼作爲方法。但結果是錯誤的。

任何人都可以幫忙嗎?

回答

0

錯誤表示您在setObjectForkey中設置nil。正確檢查參數。我們已經將城市飛艇添加到我們的橘子醬項目中,所以我相信這不是Urban Airship的缺陷。

+0

您是否找到了在擴展中實現didFinishLaunchWithOptions的方法?或者你只是在你的應用程序的某個地方調用了[UAirship takeOff]方法? – gluklichman

+0

如果您的意思是'didFinishLaunchingWithOptions'方法比我想這很棘手,因爲它只在UIApplicationDelegate上調用。您可以改爲使用UIApplicationDidFinishLaunchingNotification。檢查Marmalade的推送來源 - 這裏的通知 - https://github.com/marmalade/s3eIOSNotifications/blob/master/source/iphone/s3eIOSNotifications_platform.mm 他們有你可能感興趣的代碼,儘管大部分代碼都被註釋了出去,但你仍然可以發現它很有用。 – noob

+0

感謝您的幫助。 – gluklichman