• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crash with ARC enabled on Xcode 6.1
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash with ARC enabled on Xcode 6.1


  • Subject: Re: Crash with ARC enabled on Xcode 6.1
  • From: Beinan Li <email@hidden>
  • Date: Wed, 22 Oct 2014 17:45:07 -0400

It is quite unpredictable.
At first it crashes at a dictionary creation line in a .mm implementation
like this:

- (NSString*) getAVAudioSessionMode:(myAudioSessionMode)modeKey {
NSDictionary* modeDict = @{ // Here it crashes
   @(myAudioSessionModeDefault): AVAudioSessionModeDefault,
   @(myAudioSessionModeVoiceChat): AVAudioSessionModeVoiceChat,
   @(myAudioSessionModeGameChat): AVAudioSessionModeGameChat,
   @(myAudioSessionModeVideoRecording): AVAudioSessionModeVideoRecording,
   @(myAudioSessionModeMeasurement): AVAudioSessionModeMeasurement,
   @(myAudioSessionModeMoviePlayback): AVAudioSessionModeMoviePlayback,
   @(myAudioSessionModeVideoChat): AVAudioSessionModeVideoChat
   };
 NSString* mode = [modeDict objectForKey:@(mySettings.audioSession.eMode)];
return mode;
}

The backtrace gives me:

* thread #1: tid = 0x2403, 0x0013148c MyDemo`-[MyImp
getAVAudioSessionMode:](self=0x1e839a80, _cmd=0x002d3077,
modeKey=myAudioSessionModeDefault) + 676 at MyImp.mm:78, queue =
'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0:
0x0013148c MyDemo -[MyImp getAVAudioSessionMode:](self=0x1e839a80,
_cmd=0x002d3077, modeKey=myAudioSessionModeDefault) + 676 at MyImp.mm:78

Then if I remove this dictionary all together and do it like this:

- (NSString*) getAVAudioSessionMode:(myAudioSessionMode)modeKey {
return AVAudioSessionModeDefault;
}

Then I get a crash right in the main.mm:

int retVal = UIApplicationMain(argc, argv, nil, @"MyDemoAppDelegate");

backtrace:

* thread #1: tid = 0x2403, 0x3c4df350 libsystem_kernel.dylib`__pthread_kill
+ 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x3c4df350 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x3c456122 libsystem_c.dylib`pthread_kill + 58
    frame #2: 0x3c492972 libsystem_c.dylib`abort + 94
    frame #3: 0x3ba30d4e libc++abi.dylib`abort_message + 74
    frame #4: 0x3ba2dff8 libc++abi.dylib`default_terminate() + 24
    frame #5: 0x3bfe1a76 libobjc.A.dylib`_objc_terminate() + 146
    frame #6: 0x3ba2e07a libc++abi.dylib`safe_handler_caller(void (*)()) +
78
    frame #7: 0x3ba2e114 libc++abi.dylib`std::terminate() + 20
    frame #8: 0x3ba2f598 libc++abi.dylib`__cxa_rethrow + 88
    frame #9: 0x3bfe19d0 libobjc.A.dylib`objc_exception_rethrow + 12
    frame #10: 0x34243f20 CoreFoundation`CFRunLoopRunSpecific + 456
    frame #11: 0x34243d48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #12: 0x3615c484 UIKit`-[UIApplication _run] + 668
    frame #13: 0x36159300 UIKit`UIApplicationMain + 1120
  * frame #14: 0x00033212 MyDemo`main(argc=1, argv=0x2fdd6c68) + 378 at
main.mm:27

Something tells me that this is a memory bug.

Thanks,
Beinan


Thanks,
Beinan


On Wed, Oct 22, 2014 at 5:12 PM, David Duncan <email@hidden>
wrote:

> How is your application crashing?
>
> > On Oct 22, 2014, at 2:10 PM, Beinan Li <email@hidden> wrote:
> >
> > Hi CocoaDev,
> >
> > Not sure if it's the right list to post to.
> >
> > My iOS app is coded in Obj-C++ with the ObjC part using ARC.
> > It seemed to work well with Xcode 6.0.x and iOS 8.0 SDK.
> >
> > However, on Xcode 6.1 and iOS 8.1 SDK it starts to crash right away.
> > And it stops crashing if I turn off ARC.
> >
> > I wonder if there are changes in Xcode 6.1 that I need to know about
> > to fix this.
> >
> > Thanks,
> > Beinan
> > _______________________________________________
> >
> > Cocoa-dev mailing list (email@hidden)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> >
> >
> > This email sent to email@hidden
>
> --
> David Duncan
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Crash with ARC enabled on Xcode 6.1
      • From: Scott Ribe <email@hidden>
    • Re: Crash with ARC enabled on Xcode 6.1
      • From: Beinan Li <email@hidden>
References: 
 >Crash with ARC enabled on Xcode 6.1 (From: Beinan Li <email@hidden>)
 >Re: Crash with ARC enabled on Xcode 6.1 (From: David Duncan <email@hidden>)

  • Prev by Date: Re: Crash with ARC enabled on Xcode 6.1
  • Next by Date: Re: Crash with ARC enabled on Xcode 6.1
  • Previous by thread: Re: Crash with ARC enabled on Xcode 6.1
  • Next by thread: Re: Crash with ARC enabled on Xcode 6.1
  • Index(es):
    • Date
    • Thread