当我在设备上调用我的地图视图控制器时,应用程序就会卡住,没有任何反应,XCode甚至不会抛出错误。 但是相同的代码在模拟器上运行得很好。我的代码用于呈现地图视图:
-(IBAction)mapButtonAction
{
//storyboard
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
//navigation controller
MapViewController *vc=[sb instantiateViewControllerWithIdentifier:@"MapViewController"];
vc.coordinates = coordinates;
vc.locationName = locationName;
//warp as UINavigationController
UINavigationController *vc2 = [[UINavigationController alloc]initWithRootViewController:vc];
[[self navigationController] presentViewController:vc2 animated:YES completion:nil];
}
我尝试删除并再次添加MapKit和CoreLocation框架,重新启动XCode,还检查我的基础SDK是iOS 6.1并在设备上删除并重建应用程序。当我制作地图视图根视图控制器时,它加载得很好。 B.T.W我的设备是iPhone 4,互联网连接和gps工作得很好,在gps应用程序下的隐私设置已经批准。有什么想法吗?!