2011-10-06 2 views
5

UIApplication 개체에서 처음으로 registerForRemoteNotificationTypes:을 호출하면 a UIAlertView이 "[앱]에서 푸시 알림을 보내려고합니다."라는 메시지가 나타납니다."앱이 푸시 알림을 보내려고합니다"라는 경고 메시지에 대한 응답 캡처

AlertView에서 "확인"또는 "허용 안 함"을 탭하면 알 수있는 방법이 있습니까?

현재 AppDelegate에 대해 사용자가 결정하기 전에 application:didRegisterForRemoteNotificationsWithDeviceToken:이 호출됩니다.

내가 처음 묻는 이유는 ViewControllerNotification 옵션으로 푸시하려고하기 때문입니다. 단, 사용자가 알림을 수신하겠다고 표시 한 경우에만해야합니다.

답변

3

당신은 UIApplication의 다음 방법을 사용할 수 있습니다

응용 프로그램이 수용 통지의 유형을 돌려줍니다. didRegisterForRemoteNotificationsWithDeviceToken :`당신이 OK ""허용 안 함 "을 누르거나 전에도라고 예를 들어

- (UIRemoteNotificationType)enabledRemoteNotificationTypes 

,

UIRemoteNotificationType status = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; 
if (status == UIRemoteNotificationTypeNone) 
{ 
    NSLog(@"user is not subscribed to receive push notifications"); 
} 
+3

감사하지만, 실제로 제가하는 데 문제는 응용 프로그램이'이다 "를 클릭하십시오. 그래서이 시점에서'enabledRemoteNotificationTypes'는 항상'UIRemoteNotificationNone'입니다. 내가 선택했을 때'registerForRemoteNotificationTypes :'를 다시 호출해야한다고 생각한다. – vtim

관련 문제