Strange issue due to block support for iOS 3.1.3
since I am regularly testing my app on a 3.1.3 device, I had to add a linker flag "-weak_library /usr/lib/libSystem.B.dylib" to support blocks there. This was no issue until I just started to add some gamecenter coding from the Apple samples. Only in simulator, I then faced an instant crash (EXC_BAD_ACCESS) somewhere deep in Apple's libs when a block (even an empty one) is handed over as an authentication callback in the GC coding. When I provide nil as callback, GC logon works fine and the app continues. It works fine though on all real devices (iPad, iPhone with iOS 4.3, i开发者_开发技巧Pod with iOS 3.1.3 -- of course w/o GC then). When I remove the weak link flag for the linker, it will also run w/o problems in simulator. Has anyone any clue what is going on there? This is not a satisfactory solution to add the linker flag only eachh time I want to deploy to my ancient iPod.
Thanks, habitoti
An Apple engineer knew the right answer:
-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator. Use -weak-lSystem instead.
This actually works!
精彩评论