2016-10-03 92 views
1

私のアプリケーションのユーザの場所では、アプリケーションの起動時に許可のポップアップが何度も点滅します。私のコードのapplicationDidBecomeActiveでiOS 10でapplicationDidBecomeActiveが複数回呼び出されました

私のコード

AppDelegate.m 

- (void)applicationDidBecomeActive:(UIApplication *)application 
{ 
    [self.shareModel startMonitoringLocation]; 
} 

LocationManager.m 

- (void)startMonitoringLocation { 
    if (_anotherLocationManager) 
     [_anotherLocationManager stopMonitoringSignificantLocationChanges]; 

    self.anotherLocationManager = [[CLLocationManager alloc]init]; 
    _anotherLocationManager.delegate = self; 
    _anotherLocationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; 
    _anotherLocationManager.activityType = CLActivityTypeOtherNavigation; 
    _anotherLocationManager.allowsBackgroundLocationUpdates=YES; 
    if(IS_OS_8_OR_LATER) { 
     [_anotherLocationManager requestAlwaysAuthorization]; 
    } 
    [_anotherLocationManager startMonitoringSignificantLocationChanges]; 
} 

私のアプリは、最新の更新

Rejection issue: 

From Apple 
2. 1 PERFORMANCE: APP COMPLETENESS 
Performance - 2.1 


We discovered one or more bugs in your app when reviewed on iPad and iPhone running iOS 10.0.2 on Wi-Fi connected to an IPv6 network. 

Specifically, your app’s Background Location modal alert continuously appears and prevents access to the app. 

Next Steps 

Please run your app on a device while connected to an IPv6 network (all apps must support IPv6) to identify the issue(s), then revise and resubmit your app for review. 

で拒否されたため、これにアプリケーションの起動に何回も何回も呼ばれ、したがって、locationmanagerポップアップされた私が持っています数日間調査したが、iOS10で問題を見つけることができなかった。

applicationDidFinishLaunchingWithOptions: 

か試す中

[self.shareModel startMonitoringLocation]; 

を追加しないのはなぜ任意のアイデア/提案は&非常に感謝して

+2

あなたのアプリケーションになるだろう(権限ダイアログなどの)システムダイアログが表示され、そのダイアログが閉じられるとアクティブになりますので、おそらくdidEnterForegroundを使用してください。 – Paulw11

+0

@ Paulw11あなたが言ったように、applicationDidBecomeActiveは毎回許可ダイアログが消されると言いました。しかし、私たちはiOSにdidEnterForegroundを持っていないし、permissionsWebEnterForegroundが呼び出されていないときにアクセス権ダイアログが解除されています。さらに進める方法を教えてください。 – Honey

+0

なぜ許可ダイアログが閉じられたのか知りたいのですが?ユーザーが所在地許可リクエストに応答した後で何かをしようとしているなら、あなたは 'didChangeAuthorization'ロケーションマネージャデリゲートメソッド – Paulw11

答えて

0

非常に参考になる:

- (void)startMonitoringLocation { 
if (_anotherLocationManager == nil) { 
self.anotherLocationManager = [[CLLocationManager alloc]init]; 
_anotherLocationManager.delegate = self; 
_anotherLocationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; 
_anotherLocationManager.activityType = CLActivityTypeOtherNavigation; 
_anotherLocationManager.allowsBackgroundLocationUpdates=YES; 

if(IS_OS_8_OR_LATER) { 
    [_anotherLocationManager requestAlwaysAuthorization]; 
} 
[_anotherLocationManager startMonitoringSignificantLocationChanges]; 
} else { 
    [_anotherLocationManager stopMonitoringSignificantLocationChanges]; 
} 
} 
関連する問題