Xcode 4.5.1中的Tethered vs. Untethered

时间:2012-10-08 18:20:14

标签: ios

我已根据How to use device tokens in different ways in iphone?

调整了此代码
- (void)sendProviderDeviceToken:(NSString *)tokenString {
NSString *udid = [[UIDevice currentDevice] uniqueIdentifier];

NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
UIRemoteNotificationType type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

NSString *data = [NSString stringWithFormat:@"udid=%@&token=%@&id=%@&type=%i", udid, tokenString, bundleID, type];
NSString *escapedData = [[data description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSString *httpRequestURLString = [NSString stringWithFormat:@"http://%@/RegisterDevice.cgi?%@", kRegistrationURI, escapedData];
NSURL    *httpRequestURL       = [NSURL URLWithString:httpRequestURLString];
}

当设备被束缚时代码正常工作,但一旦断开设备,它就会停止工作。

显然,我有一些缺失,但不是很明显

这是我的第一个问题。我希望我遵循正确的形式...

0 个答案:

没有答案