【问题标题】:Urban Airship with marmalade SDK带有果酱 SDK 的城市飞艇
【发布时间】:2014-03-13 14:49:12
【问题描述】:

我正在尝试将 Urban Airship 集成到我的应用程序中。一些错误 发生在 UAirship:takeOff 期间。我写了常见问题解答,但没有人回复我。

我正在使用以下代码:

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

然后,当调用 takeOff 方法时,应用程序崩溃了,我得到了 以下输出:

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++ 代码调用)的能力。问题是,扩展 dont support all the app delegate events. For example, in Urban Airship sample code takeOff method is called from didFinishLaunchingWithOptions. But extensions are initialised later, than this message occured in appdelegate, so it cant 被处理。 我尝试从主线程调用上面的代码作为方法。但是结果是错误的。

有人可以帮忙吗?

【问题讨论】:

    标签: ios urbanairship.com marmalade


    【解决方案1】:

    错误表明您在setObjectForkey 中设置nil。正确检查参数。我们也将城市飞艇添加到我们的果酱项目中,所以我确信这不是 Urban Airship 的错误。

    【讨论】:

    • 你找到在扩展中实现 didFinishLaunchWithOptions 的方法了吗?或者你只是在你的应用程序的某个地方调用了一个带有 [UAirship takeOff] 的方法?
    • 如果你的意思是 'didFinishLaunchingWithOptions' 方法,我猜这很棘手,因为它只在 UIApplicationDelegate 上调用。您可以改为使用 UIApplicationDidFinishLaunchingNotification。检查 Marmalade 的推送源 - 通知在这里 - github.com/marmalade/s3eIOSNotifications/blob/master/source/… 他们有您可能感兴趣的代码,虽然大部分代码已被注释掉,但您仍然可以发现它很有用。
    • 感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多