在我的应用程序中使用块仅在 iOS4.3 上导致 EXC_BAD_ACCESS
我已将 LambdaAlert 中的示例代码粘贴到我的当我在 iOS4.3 上运行时,它会生成 EXC_BAD_ACCESS 错误。相同的代码在旧版本的操作系统中运行良好。
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,我需要做一些不同的事情吗?
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];
Is there something I need to do differently for iOS4.3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
-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.