저는 처음에는 iphone 기술에 익숙합니다. 지금은 밀어 넣기 알림을 구현해야하는 응용 프로그램과 작업하고 있습니다. 또한시뮬레이터에서 장치 토큰 요청에 대한 응답이 없습니다.
http://mobiforge.com/developing/story/programming-apple-push-notification-services#comment-7850
, 다음 코드를 사용 :
나는 링크를 따라NSLog(@"Registering for push notifications...");
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
NSLog(str);
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
NSString *str = [NSString stringWithFormat: @"Error: %@", err];
NSLog(str);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
for (id key in userInfo)
{
NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
}
}
것은 내가 프로그램을 실행할 때, 내가 디버거 창에서 장치 토큰을 받아야한다 코드별로 다음과 같은 오류가 표시됩니다.
" Error in registration. Error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x6e055a0 {NSLocalizedDescription=remote notifications are not supported in the simulator} "
어떻게이 문제를 해결해야합니까?
친절하게 도와주세요.
감사합니다.
좋아 .. 나는 그걸 모르고 있었어. 설명에 대해 언제나 고마워. – Sarah
나는 Madhup의 답변 후에 이것을 게시했다. 디버그 콘솔이하는 일에 대해 혼란 스러울 것 같기 때문이다. – Beaker
예, 모두 혼란 스러웠습니다. – Sarah