1) 아래 메소드를 구현했습니다. didReceiveRemoteNotification을 이해했습니다 : iOS7 +에서 fetchCompleteionHandler가 작동합니다. 또한 요청 작업을 완료하는 데 30 초 밖에 걸리지 않습니다.ios 푸시 알림 - 백그라운드에서 앱을 사용하는 동안 비동기 콜백에서 웹 서비스의 응답을받을 수 없습니다.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler
{
// Invoke Asynchronous request to get additional data.
[NSURLConnection sendAsynchronousRequest:theRequest
queue:[NSOperationQueue mainQueue] // created at class init
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){
// Handling Response Data here.
// DISPLAY ALERT HERE.
}
}
질문 :
1) I 응용 프로그램이 전경에 있지 않으면 경고 또는 NSLog 출력을 볼 수없는 해요. 내가 응용 프로그램을 시작하면 볼 수 있습니다.
내가 뭘 잘못하고 있니?
구성한 푸시 알림 유형은 무엇입니까? Badge/Sound/Alert입니까? –
모두 구성되었지만 배지, 컨텐츠 사용 가능, armyID 만 전송합니다. 또한 didReceiveRemoteNotification을 실행하고 서버 측에서 요청을 처리 할 수 있습니다. 응용 프로그램이 포 그라운드 상태가되면 응답 만 전달됩니다. – Whoami