iPhone 的城市飞艇推送通知:SSL 问题
我想通过 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“操作无法完成。(OSStatus错误 - 9807.)", NSLocalizedDescription=发生连接失败:SSL 问题(可能是错误/过期/自签名证书)}*
我使用的是从 Itunes Connect 下载的同一证书。 此外,当我访问 APN 时,证书似乎没问题,那么什么会导致我的问题呢?
(PS - 该证书用于开发,因此用于 UrbanAirship 应用程序)
I want to use push notifications on iphone through Urban Airship, and i'm using their client library for iOS.
I integrated the library inside my project and everything compiles correctly.
On application launch, i'm trying to register my device token to the UrbanAirship server:
- (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;
}
Now, I noticed that i'm getting the device token from apple, but when i'm trying to register it in the UrbanAirship server i'm getting error messages in the console from the UALOG about ssl problem:
* Request ERROR [registering device token]
Error: Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred: SSL problem (possibly a bad/expired/self-signed certificate)" UserInfo=0x2b2aa0 {NSUnderlyingError=0x2aedb0 "The operation couldn’t be completed. (OSStatus error -9807.)", NSLocalizedDescription=A connection failure occurred: SSL problem (possibly a bad/expired/self-signed certificate)}*
I'm using the same certificate that I downloaded from the Itunes Connect.
Moreover, the cert seems to be OK when i'm accessing the APNs, so what can cause my problem?
(PS - The certificate is for development and so the UrbanAirship Application)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
天哪......
看起来解决方案非常简单:
日期和时间设备上的时间设置必须正确,否则证书将无效。
显然,如果你擦除设备并将其恢复为出厂默认设置,时间就会回到 1970 年代......
UrbanAirship 支持
Oh god....
It appears that the solution is pretty simple:
The Date & Time settings on the device must be correct or the certificate won't be valid.
Apparently, if you wipe the device and restore it to factory defaults the time goes back to 1970's....
The Solution from UrbanAirship support