2014-07-14 3 views
1

에서 응용 프로그램은 내가 사용 일정 변경 알림을 등록 할 때 점화되지 않음 다음EKEventStore 변경 알림 배경

- (void) registerForLocalCalendarChanges 
{ 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localCalendarStoreChanged) name:EKEventStoreChangedNotification object:self.store  ]; 
} 

변경이 로컬 달력을 만든 경우는 다음을 호출해야합니다 :

- (void) localCalendarStoreChanged 
{ 
// This gets called when an event in store changes 
// you have to go through the calendar to look for changes 
// launch this in a thread of its own! 
ashsysCalendarEventReporter *eventReport = [ashsysCalendarEventReporter new]; 

NSLog(@"Local Calendar Store Changed"); 

[NSThread detachNewThreadSelector:@selector(getCalendarEvents) toTarget:eventReport withObject:nil]; 
} 

하지만 ... 앱을 시작한 다음 백그라운드로 보내면 캘린더 항목을 변경할 수 있으므로 캘린더 항목을 변경할 때 아무런 변화가 없습니다. 앱으로 돌아 가면 발사됩니다. 그러나 물론 그것은 목적이 아닙니다. ...

@property (strong,nonatomic) EKEventStore *store; 

업데이트 내가 배경 가져에게로 가지고있는 물건을 보여 깜빡 :

저장소와 헤더 파일에 정의되어 있습니다.

- (void) application:(UIApplication*) application performFetchWithCompletionHandler:(void (^) (UIBackgroundFetchResult))completionHandler 
{ 
// UIBackgroundTaskIdentifier uploadCalInfo = [application beginBackgroundTaskWithExpirationHandler:nil]; 
NSLog(@"A fetch got called"); 
// ashsysCalendarEventReporter *eventReport = [ashsysCalendarEventReporter new]; 
// [eventReport getCalendarEvents]; 
// // [NSThread detachNewThreadSelector:@selector(getCalendarEvents) toTarget:eventReport withObject:nil]; 
// [application endBackgroundTask:uploadCalInfo]; 
completionHandler(UIBackgroundFetchResultNewData); 

performFetch 일부 전혀 달력에 관련된 임의의 시간처럼 보일 무엇 호출됩니다 :

은 didFinishLaunchingWithOptions

[application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; 

이 응용 프로그램의 위임에입니다. 백그라운드 가져 오기를 실행하는 것을 찾아내는 방법이 있습니까? 항상 달력입니까? 실제 실행은 주석 처리되어 있습니다 - 정확합니까?

무엇이 누락 되었습니까?

답변

0

저는이 답변을 직접 찾으려고 노력하고 있으며 실제로이를 수행 할 실제 방법이 있다고 생각하지 않습니다.

일시 중지되기 전에 공유 시스템 리소스 사용을 중지하십시오. As per Apple's documentation : 백그라운드 상태에서 시스템 리소스에 액세스 할 수 없습니다. 주소록이나 캘린더 데이터베이스와 같은 공유 시스템 리소스와 상호 작용하는 앱은 일시 중지되기 전에 해당 리소스의 사용을 중지해야합니다. 이러한 리소스의 우선 순위는 항상 포 그라운드 앱으로 이동합니다. 앱이 일시 중지 된 경우 공유 리소스를 사용하고있는 것으로 확인되면 앱이 종료됩니다.

저는 여전히 더 나은 답변을 찾고 있습니다./해결 방법을 찾지 만 다른 사람들로부터 이것을 듣고 싶습니다.