ios - 调试错误 xcode 6- 使用 google maps sdk

标签 ios objective-c google-maps xcode6

我正在测试我的应用程序,每当我尝试打开一个使用 map 的 View 时,应用程序就会终止并出现此错误

'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'

我的代码是这样写的:

   CGRect s = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height-50);

    GMSCameraPosition *theCamera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude
                                                             longitude:locationManager.location.coordinate.longitude
                                                                  zoom:18];


    self.mapView= [GMSMapView mapWithFrame:s camera:theCamera];

这就是我初始化 map 的方式。

这是控制台中的完整错误消息:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSBundle initWithURL:]: nil URL argument' * First throw call stack: (0x187e52084 0x1984300e4 0x187e51fc4 0x188cadc08 0x188cadb84 0x100377ba8 0x100377b28 0x1003a8dc8 0x100aa4ee0 0x100aa5dec 0x1003a8bb8 0x1003a638c 0x1003a62b4 0x1003a6d18 0x10039f330 0x10039ecb8 0x10039eb50 0x1001957dc 0x18c5d4ccc 0x18c5d49dc 0x18ccc0644 0x18c8ce674 0x18c8e9588 0x18c8eb99c 0x18c6c1c88 0x1001adc64 0x18c608e68 0x18c5f1fc0 0x18c608804 0x18c608490 0x18c6019e4 0x18c5d51d4 0x18c87398c 0x18c5d373c 0x187e0a324 0x187e095c8 0x187e07678 0x187d35664 0x190e775a4 0x18c63a4f8 0x100081c00 0x198a9ea08) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

最佳答案

您需要将 GoogleMaps.bundle 添加到项目的框架中。 您可以在 GoogleMaps.framework/Versions/A/Resources 中找到它。并确保未选中“需要时复制项目”

您也可以尝试此处建议的解决方案: Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target under 'Copy Bundle Resources

关于ios - 调试错误 xcode 6- 使用 google maps sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26221389/

相关文章:

iOS 7 UINavigationController 不平衡调用开始/结束外观转换

ios - 更改 subview 的高度约束后,uitableview 单元格不更新单元格高度

java - 添加导航按钮到 map

iphone - 使用用户 token 、rest/rails 和钥匙串(keychain)帮助进行 iOS 身份验证

javascript - Google map - 从 Google map 获取省份轮廓

ios - 如何在 swift 4 中将 GMSMapView 添加到 View 的一部分

iphone - Facebook API SDK 3.0 "An error occurred with app"

ios - 单个 NSString 的样式 plist 输出

ios - UITextView删除UILongPressGestureRecognizer

objective-c - (25) 和@(25) 之间的区别