アプリケーションにプッシュ通知を実装する必要があります。実際、サーバーからメッセージを受信する必要があります。iPhoneアプリケーションにプッシュ通知を実装する方法を教えてください。
13718 次
2 に答える
7
クライアント側のものは簡単ですが、良い例が必要な場合は、 http://bitbucket.org/urbanairship/push_sample/からダウンロードできるものを提供しています。
サーバー側の作業ははるかに難しいことがわかります。そのためには、多くのアドオン機能で使用できるシンプルな RESTful サービスを提供し、インディー パッケージが無料であるため、Urban Airship を使用することをお勧めします。
http://urbanairship.com/docs/push_index.html
注意: 私はそこで働いています。
于 2010-04-02T17:00:06.253 に答える
3
これらの 2 つのデリゲート メソッドをアプリケーションに実装する必要があります。
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
//NSLog(@"Entered into Method");
NSString *myDevTokenString = [devToken description];
NSLog(myDevTokenString);
self.tokenAsString = [[devToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
NSLog(@"token As String:%@", tokenAsString);
//const void *devTokenBytes = [devToken bytes];
//NSLog(@"My Token is : %@",devToken);
//self.registered = YES;
// UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient-GotToken" message:myDevTokenString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
// [myAlert show];
// [myAlert release];
//[self sendProviderDeviceToken:devTokenBytes]; // custom method
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
//UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient" message:@"called -Error- Method" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
// [myAlert show];
// [myAlert release];
NSString *errText = [[NSString alloc] initWithFormat:@"APN Error:%@",err];
NSLog(@"Error in registration. Error: %@", errText);
}
于 2010-04-01T07:39:15.180 に答える