2012-09-13 3 views
1

앱을 종료하지 않고 위치 서비스 알림을 다시 호출하여 설정 페이지로 이동할 수 있습니까? 일부 사용자는 팝업을 받으면 '허용하거나 허용하지 않음'을 선택해야하는지 여부는 알지 못합니다. 문제의 해결책.위치 서비스 알림

+0

정확히 무엇을 요구하고 있습니까? 위치 액세스를 수정하기 위해 사용자를 설정 페이지로 연결하려는 경우 더 이상 설정할 수 없습니다. 이 질문을보십시오 : http://stackoverflow.com/questions/9627451/how-to-open-preferences-settings-with-ios-5-1 – johngraham

답변

4

사용자에게 위치 서비스 상태를 알리려는 경우 사용자가 자신의 위치 서비스 상태를 알리고 사용자를 설정 페이지로 이동할 수 있습니다.

 - (void) showLocationAlert { 

       if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusAuthorized) { 

         //Check whether Settings page is openable (iOS 5.1 not allows Settings page to be opened via openURL:) 
         if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]]) { 
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service,Turn on location service to allow \"YourApp\" to determine your location" delegate:self cancelButtonTitle:@"Settings" otherButtonTitles:@"Cancel", nil]; 
          [alert show]; 

         } 
         else { 
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:@"You must enable location service" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; 
          [alert show]; 
         } 
       } 
      } 



    - (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { 
      if (buttonIndex == 0) { 
       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES"]]; 
      } 

     } 
+0

고마워요!이게 내 해결책일지도 몰라 – user1531399

0

불행히도, 장치가 Jailbroken이 아닌 이상 그렇게 할 수 없습니다. 그러나 사용자를 설정 창에서 올바른 영역으로 라우팅하는 것은 비교적 간단합니다.

+0

고마워요. 남자 ^^ – user1531399