2012-07-21 2 views
1

다른 장치의 코어 데이터에서 항목이 변경되면 NSLog 메시지에 변경 사항이 표시되지만 NSPersistentStoreDidImportUbiquitousContentChangesNotification이 호출되지 않고 있음을 알 수 있습니다. 그것은 내 tableview 업데이 트를 알기 위해 내 첫 번째 장치에 저장 때까지 걸립니다. 이 작동되지 않는 이유NSPersistentStoreDidImportUbiquitousContentChanges 알림이 수신되지 않음

[[NSNotificationCenter defaultCenter] addObserver:self 
              selector:@selector(iCloudUpdates:) 
               name:NSPersistentStoreDidImportUbiquitousContentChangesNotification 
               object:nil]; 

누구가 알고

이 내 코드?

답변

3

첫 번째 옵션 : 두 장치를 모두 업데이트하는 데 문제가 있다면 정상 동작이므로 Apple은 업데이트 타이밍을 보장하지 않지만 일반적으로 빠릅니다.

문제가 호출되지 iCloudUpdates 방법 서명이 올바른지 확인이다 반대편에,해야하는 경우 :

-(void)iCloudUpdates:(NSNotification*)notification { 
    // do your stuff here 
} 

두 번째 옵션 : 글을 쓰는 시간에,에서 iOS 5는 큰 큰 문제가 iCloud 및 CoreData를 사용하여 최근에 iCloud 지원없이 응용 프로그램을 출하했습니다.

당신이 넣어 CoreData 및 iCloud에 모두 로그온 차례에 무슨 일이 일어나고 있는지 알고 싶다면

: 당신의 계획 관리자에서

-com.apple.CoreData.SQLDebug 1 
-com.apple.coredata.ubiquity.logLevel 3 

, 실행 -> 인수 탭에서.

'대상'기기에 이상한 오류가 표시되는 경우 iCloud가 도청되지 않아 작동하지 않는 경우입니다.

1

당신의 코드 문제는 "addObserver"에서 객체를 nil로 설정했다고 생각합니다. 다음과 같이 객체는 persistentStoreCoordinator 여야합니다.

__weak NSPersistentStoreCoordinator *psc = self.context.persistentStoreCoordinator; 

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(iCloudUpdates:) 
              name:NSPersistentStoreDidImportUbiquitousContentChangesNotification 
              object:psc]; 
관련 문제