2013年10月21日 星期一

ios google map api 出現 NSInvalidArgumentException', reason: '+[GMSCameraPosition .. error

今天在開發使用Google Maps API for iOS

出現以下error 2013-10-22 10:13:52.736 HM[1155:12e03] +[GMSCameraPosition cameraWithLatitude:longitude:zoom(inlove): unrecognized selector sent to class 0x3305b0 2013-10-22 10:13:52.737 HM[1155:12e03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[GMSCameraPosition cameraWithLatitude:longitude:zoom(inlove): unrecognized selector sent to class 0x3305b0' *** First throw call stack: (0x273f012 0x2564e7e 0x27ca2ad 0x272ebbc 0x272e94e 0x6cf6f 0x158a1c7 0x158a232 0x158a4da 0x15a18e5 0x15a19cb 0x15a1c76 0x15a1d71 0x15a289b 0x15a2e93 0x15a2a88 0x18fee63 0x18f0b99 0x18f0c14 0x2578705 0x14ac2c0 0x14ac258 0x156d021 0x156d57f 0x156c6e8 0x14dbcef 0x14dbf02 0x14b9d4a 0x14ab698 0x3216df9 0x3216ad0 0x26b4bf5 0x26b4962 0x26e5bb6 0x26e4f44 0x26e4e1b 0x32157e3 0x3215668 0x14a8ffc 0x2dbd 0x2ce5) libc++abi.dylib: terminate called throwing an exception

主要解決方案是 到
Project → Build Settings → 搜尋 Other Linker Flag → Other Linker Flags -> 加入 -ObjC

這樣就可以解決此問題。

不過 接下來又出現一個問題,

就是

GMSServicesException', reason: 'GoogleMaps.bundle requires Google Maps SDK for iOS to be part of your target under 'Copy Bundle Resources''

的error

此error只要將你Frameworks裡的
GoogleMaps.framework 右鍵→show in finder -> Resources → GoogleMaps.bundle拉到

Frameworks的資料夾 我是沒有將copy items into destination groups folder 打勾,

因為GoogleMaps.framework已經copy items在project裡頭了~

沒有留言: