Strange issue due to block support for iOS 3.1.3

2019-07-03 23:49发布

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, iPod 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

1条回答
祖国的老花朵
2楼-- · 2019-07-04 00:43

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!

查看更多
登录 后发表回答