2010-03-26 93 views
0

我有一个关于iphone开发的问题。我正在为使用gps的iPhone构建应用程序,我可以通过提醒用户是否想要使用gps,从我的应用程序解决gps问题。正如你知道什么时候会尝试使用gps一样,iPhone内置的gps会询问是否允许它使用。所以这里是我的问题,我怎么能知道用户点击iPhone的内置弹出内置iphone弹出窗口处理

因为我显示“Gps不工作”警告失败。那么,如何才能让警报弹出时,仅通过GPS无法正常工作,而不是当用户点击“他并不想使用GPS”

回答

0

实施

- (void)locationManager: (CLLocationManager *)manager 
     didFailWithError: (NSError *)error 

委托方法...如果error code是= kCLErrorNetwork那么它是GPS错误,如果error code = kCLErrorDenied然后用户拒绝...你可以把开关案例如

switch([error code]) 
    { 
     case kCLErrorNetwork: // general, network-related error 
     { 
      UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"please check your network connection or that you are not in airplane mode" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; 
      [alert show]; 
      [alert release]; 
     } 
     case kCLErrorDenied:{ 
      //User has denied 
      return; 
     }...