1

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?

Kirby Todd
  • 11,254
  • 3
  • 32
  • 60
  • I'd contact the author of LambdaAlert. – amattn Apr 19 '11 at 16:52
  • It's not specific to that class. I've tried other blocks and it fails in every case. – Kirby Todd Apr 20 '11 at 03:23
  • How can I start a bounty on this? It seems I can make bounties on any questions but mine. – Kirby Todd Apr 20 '11 at 07:44
  • Okay, more info. If I run the stock Lambda-Alert demo app in iOS4.3 it works fine so there's something in my projects build settings that's causing this but I really don't know where to begin to find what it is. – Kirby Todd Apr 20 '11 at 08:03
  • 1
    Found the root cause but not sure the fix. In my project's linker flags I have: -weak_library /usr/lib/libSystem.B.dylib to flurry. If I remove that then it works fine on iOS4.3 but I still need for flurry. Is there a solution that will let iOS4.3 and -weak_library /usr/lib/libSystem.B.dylib coexist? – Kirby Todd Apr 20 '11 at 08:43
  • The problem is simply a bug in the iOS Simulator. The codes works fine on the device. I've filled a radar on Apple's bug reporter (radar://9470793) – gcamp May 31 '11 at 18:17

1 Answers1

1

-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator. Use -weak-lSystem instead.

gcamp
  • 14,622
  • 4
  • 54
  • 85