3

我想通过 Urban Airship 在 iphone 上使用推送通知,并且我正在使用他们的 iOS 客户端库。

我将库集成到我的项目中,一切都正确编译。

在应用程序启动时,我正在尝试将我的设备令牌注册到 UrbanAirship 服务器:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{    
    //Init Airship launch options
    NSMutableDictionary *takeOffOptions = [[[NSMutableDictionary alloc] init] autorelease];
    [takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];

    // Create Airship singleton that's used to talk to Urban Airhship servers.
    // Please populate AirshipConfig.plist with your info from http://go.urbanairship.com
    [UAirship takeOff:takeOffOptions];

    [[UAPush shared] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                                         UIRemoteNotificationTypeSound |
                                                         UIRemoteNotificationTypeAlert)];

    // Override point for customization after application launch.
    [window addSubview:[self.firstViewController view]];
    [self.window makeKeyAndVisible];

    return YES;
}

现在,我注意到我正在从苹果获取设备令牌,但是当我尝试在 UrbanAirship 服务器中注册它时,我在控制台中收到来自 UALOG 的有关 ssl 问题的错误消息:

* 请求错误 [注册设备令牌] 错误:错误域 = ASIHTTPRequestErrorDomain 代码 = 1 “发生连接失败:SSL 问题(可能是错误/过期/自签名证书)” UserInfo = 0x2b2aa0 {NSUnderlyingError = 0x2aedb0 “操作无法” t 完成。(OSStatus 错误 -9807.)", NSLocalizedDescription=发生连接失败:SSL 问题(可能是错误/过期/自签名证书)}*

我正在使用从 Itunes Connect 下载的相同证书。此外,当我访问 APNs 时,证书似乎没问题,那么什么会导致我的问题?

(PS - 该证书用于开发,因此是 UrbanAirship 应用程序)

4

1 回答 1

2

天啊....

看来解决方案非常简单:

设备上的日期和时间设置必须正确,否则证书将无效。

显然,如果您擦除设备并将其恢复为出厂默认设置,则时间可以追溯到 1970 年代......

UrbanAirship 支持的解决方案

于 2011-06-14T08:57:07.643 回答