2017-01-06 1 views
1

"blitzer.de"와 같은 앱을 백그라운드에서 계속 실행할 수있는 방법은 무엇입니까? enter image description here 나는이 같은 앱을 만들어서 gps 데이터를 사용하는 동안 백그라운드에서 약 2 시간 동안 실행하려고합니다. 제 연구에서 애플은 백그라운드 실행에 대해 매우 엄격하다고 말했고 3 분 내에 프로세스를 취소합니다. 또한 가져 오기가 6 분 안에 끝납니다. 어떤 도움을 주시면 감사하겠습니다.ios 앱 백그라운드 실행

+0

이 링크 확인 http://stackoverflow.com/a/35517630/2050181 –

+0

처음 확인하기 https://www.raywenderlich.com/143128/background-modes-tutorial-getting-started – AMAN77

답변

1

@Johannes

1

) 모든 응용 프로그램이 10 분 더 이상 백그라운드에서 실행할 수 있습니다. 여기에 대한 예외는 배경 사용 가능 응용 프로그램입니다. 항상를 앱의 Info.plist 파일

NSLocationAlwaysUsageDescription에 - 그래서 당신은 이제 위치 추적 권한을 요청해야)

기능에서 백그라운드 모드> 배경 모드 enter image description here

2를 활성화해야 --- 위치가 필요합니다.

NSLocationWhenInUseUsageDescription --- 위치가 필요합니다.

0이 필요합니다.

개인 정보 보호 - 위치 사용 설명 --- 내가 지금 가장 중요한 역할을 한 enter image description here

3

위치

) 이 필요합니다. 코드

self.locationManager = [[CLLocationManager alloc]init]; // initializing locationManager 
    _locationManager.desiredAccuracy = kCLLocationAccuracyBest; // setting the accuracy 
    [self.locationManager requestAlwaysAuthorization]; 
    self.locationManager.delegate = self; 
    if([self.locationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates)]) { 
     [self.locationManager setAllowsBackgroundLocationUpdates: YES]; 
    } 
    self.locationManager.distanceFilter = 50 ; // 
    self.locationManager.activityType=CLActivityTypeAutomotiveNavigation; 
    [self.locationManager startUpdatingLocation]; 
    [self.locationManager setPausesLocationUpdatesAutomatically:NO]; 

4). setPausesLocationUpdatesAutomatically : NO 앱을 계속 실행할 수 있습니다.

+1

iOS 9 이후 10 분이 3 분으로 변경되었습니다. – rckoenes

+1

최종 (코드 작성이 안되는, 아마도 가장 어려운 단계) 단계는 앱을 탐색 앱으로 Apple에 제출하고 승인하기로 동의하는 것입니다. 당신이 정상적인 네비게이션 앱이 아니라면 그것은 힘든 판매입니다. –

+0

@rocoenes 위치 승인을 요청하는 경우 생각보다 배경에 더 많은 시간을 할애 할 수 있습니다. –