我已根据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];
}
当设备被束缚时代码正常工作,但一旦断开设备,它就会停止工作。
显然,我有一些缺失,但不是很明显
这是我的第一个问题。我希望我遵循正确的形式...