unrecognized selector sent to

来源:互联网 发布:google 算法面试题 编辑:程序博客网 时间:2024/05/21 18:46

2013-01-06 14:02:08.839 BaiduMapDemo[716:f803] -[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x6c29000
2013-01-06 14:02:08.846 BaiduMapDemo[716:f803] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to instance 0x6c29000'
*** First throw call stack:
(0x15c1022 0x1b79cd6 0x15c2cbd 0x1527ed0 0x1527cb2 0xa747d 0x5fa4a 0x12508 0xee4b 0xefda 0x10b34 0x29c0 0x443386 0x444274 0x453183 0x453c38 0x447634 0x23f9ef5 0x1595195 0x14f9ff2 0x14f88da 0x14f7d84 0x14f7c9b 0x443c65 0x445626 0x28e8 0x2845)
terminate called throwing an exception(gdb) 

解决:

(1)编译正常,运行报  [UIDevice uniqueGlobalDeviceIdentifier]: unrecognized selector sent to此时需要 other linker  flags 添加 -all_load参数。

         具体:Project ->build settings ->linking->Other Linker flags
(2)编译报  Undefined symbols for architecture armv7。请检查有没有添加QuartzCore.framework 和 CoreLocation.framework
   (3)  BMKMapManager 强烈建议通过单例模式管理起来,并且不要手动调用其release方法。
   (4)  进行用户位置定位时除了要设置showsUserLocation = YES,还要在mapView:didUpdateUserLocation:方法中调用setCenterCoordinate:animated
         另外一定要在dealloc中,或者其他离开页面的地方调用showsUserLocation= NO,否则会出现第二次push到定位页面时,不会重新定位问题。
  (5) 必须至少让一个类保持.mm文件,或者按照官方修改编译器类型。
(6) lipo –create Release-iphoneos/libbaidumapapi.a Release-iphonesimulator/libbaidumapapi.a –output libbaidumapapi.a 如果报错,请改成

     lipo –create –output libbaidumapapi.a Release-iphoneos/libbaidumapapi.a Release-iphonesimulator/libbaidumapapi.a 就能解决。


我的是xcode4,以上方法并未解决问题,求助之后才解决了:

方法:targets ->build settings ->linking->Other Linker flags 添加-objc.

0 0
原创粉丝点击