在我的应用程序中使用块仅在iOS4.3上导致EXC_BAD_ACCESS [英] Using blocks in my app causes EXC_BAD_ACCESS only on iOS4.3
本文介绍了在我的应用程序中使用块仅在iOS4.3上导致EXC_BAD_ACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已粘贴 LambdaAlert 进入我的应用程序,当我在iOS4.3上运行时,它会生成EXC_BAD_ACCESS错误。相同的代码在旧版本的操作系统中运行良好。
I've pasted the example code from LambdaAlert into my app and it's generating EXC_BAD_ACCESS error when I run on iOS4.3. The same code works fine in older versions of the OS.
LambdaAlert *alert = [[LambdaAlert alloc]
initWithTitle:@"Test Alert"
message:@"See if the thing works."];
[alert addButtonWithTitle:@"Foo" block:^{ NSLog(@"Foo"); }]; // <-- Crashes here with EXC_BAD_ACCESS no matter what code is in the block (even an empty block!)
[alert addButtonWithTitle:@"Bar" block:^{ NSLog(@"Bar"); }];
[alert addButtonWithTitle:@"Cancel" block:NULL];
[alert show];
[alert release];
对于iOS4.3,我需要做些什么?
Is there something I need to do differently for iOS4.3?
推荐答案
-weak_library /usr/lib/libSystem.B.dylib
打破iOS模拟器。改为使用 -weak-lSystem
。
-weak_library /usr/lib/libSystem.B.dylib
breaks the iOS Simulator. Use -weak-lSystem
instead.
这篇关于在我的应用程序中使用块仅在iOS4.3上导致EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文