Re: Crash with ARC enabled on Xcode 6.1

2014-10-27 Thread Beinan Li
Hi All, Sorry, I have to turn this around. The problem turned out not to be the static objects at all, though I can't explain why for a short while, the crash was gone after removing them. The actual cause is the dictionary definition itself: I used a constant that is only available for

Re: Crash with ARC enabled on Xcode 6.1

2014-10-24 Thread Beinan Li
You nailed it, Kevin. Thanks so much! It is due to the static C++ wrapper object. After I moved it to the heap, the crash was fixed. Thanks, Beinan On Thu, Oct 23, 2014 at 12:50 PM, Kevin Meaney k...@yvs.eu.com wrote: Personally I'd try and not call any objective-c code from a C++ static

Re: Crash with ARC enabled on Xcode 6.1

2014-10-24 Thread Beinan Li
I'd like to thank everyone for your input. I learned a lot from this thread. BTW, simply changing the offending dictionary syntax to using the old API instead of the literals didn't help. I really had to abandon the singleton idea for the C++ wrapper object. Correct me if I'm wrong, please. I

Re: Crash with ARC enabled on Xcode 6.1

2014-10-24 Thread Glenn L. Austin
On Oct 24, 2014, at 11:44 AM, Beinan Li li.bei...@gmail.com wrote: BTW, simply changing the offending dictionary syntax to using the old API instead of the literals didn't help. I really had to abandon the singleton idea for the C++ wrapper object. Static objects -- of any kind -- can lead

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Kevin Meaney
On 23 Oct 2014, at 00:34, Beinan Li li.bei...@gmail.com wrote: Oh! I did actually. The method I posted belongs to an ObjC object which is wrapped by a C++ object. That C++ object is a singleton (static). How is this going to affect ARC and why it didn't down-right crash a week ago

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Beinan Li
Thank you Kevin! I didn't know this before. This might be it because I did at some point change the dictionary creation from the old API-based syntax to literals. Maybe I should move back to the API calls. I'll try that today. Thanks, Beinan On Thu, Oct 23, 2014 at 5:18 AM, Kevin Meaney

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Kevin Meaney
Personally I'd try and not call any objective-c code from a C++ static object. If it did look the appropriate solution then I'd make sure I was comfortable with my knowledge of the objective-c runtime and the order in which things are called before main is called. Kevin On 23 Oct 2014, at

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Greg Parker
On Oct 23, 2014, at 2:18 AM, Kevin Meaney k...@yvs.eu.com wrote: From what I understand any code that is executed before main is called is done so before the objective-c runtime is fully setup which means you have no guarantees about what will work. In objective-c++ where you can create

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Kyle Sluder
On Thu, Oct 23, 2014, at 05:06 PM, Greg Parker wrote: On Oct 23, 2014, at 2:18 AM, Kevin Meaney k...@yvs.eu.com wrote: From what I understand any code that is executed before main is called is done so before the objective-c runtime is fully setup which means you have no guarantees

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Clark S. Cox III
On Oct 23, 2014, at 15:26, Kyle Sluder k...@ksluder.com wrote: On Thu, Oct 23, 2014, at 05:06 PM, Greg Parker wrote: On Oct 23, 2014, at 2:18 AM, Kevin Meaney k...@yvs.eu.com wrote: From what I understand any code that is executed before main is called is done so before the

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Greg Parker
On Oct 23, 2014, at 3:26 PM, Kyle Sluder k...@ksluder.com wrote: On Thu, Oct 23, 2014, at 05:06 PM, Greg Parker wrote: The initialization order is generally like this: 1. Everything in libraries you link to is initialized. 2. Your classes' +load methods run. Each class runs +load before

Re: Crash with ARC enabled on Xcode 6.1

2014-10-23 Thread Scott Ribe
On Oct 23, 2014, at 10:50 AM, Kevin Meaney k...@yvs.eu.com wrote: Personally I'd try and not call any objective-c code from a C++ static object. If it did look the appropriate solution then I'd make sure I was comfortable with my knowledge of the objective-c runtime and the order in which

Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Beinan Li
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

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread David Duncan
How is your application crashing? On Oct 22, 2014, at 2:10 PM, Beinan Li li.bei...@gmail.com 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,

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Jonathan Mitchell
On 22 Oct 2014, at 22:10, Beinan Li li.bei...@gmail.com wrote: 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 reckon we need to see the crash details. Can you post them? Jonathan

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Alex Zavatone
You can add an exception breakpoint and on the bottom of the debug Navigator, drag the little slider all the way to the right to see the code execution path that is causing your crash. A exception breakpoint isn't added to any line in code, but traps when any NS exception is thrown. You

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Beinan Li
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,

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Beinan Li
Note, the initial crashing function is merely translating a C++ enum to the AVFoundation builtin constants. Thanks, Beinan On Wed, Oct 22, 2014 at 5:45 PM, Beinan Li li.bei...@gmail.com wrote: It is quite unpredictable. At first it crashes at a dictionary creation line in a .mm

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Scott Ribe
On Oct 22, 2014, at 3:45 PM, Beinan Li li.bei...@gmail.com wrote: stop reason = signal SIGABRT When there's a SIGABRT, there's usually an error logged. You should look for that, because it might give a good clue. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303)

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Kevin Meaney
Your not creating a static C++ object anywhere are you? One that creates the dictionary before main gets called by any chance? Kevin Sent from my iPhone On 22 Oct 2014, at 22:45, Beinan Li li.bei...@gmail.com wrote: Note, the initial crashing function is merely translating a C++ enum to

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Quincey Morris
On Oct 22, 2014, at 14:10 , Beinan Li li.bei...@gmail.com wrote: And it stops crashing if I turn off ARC. I don’t understand this. How do you turn off ARC? Are you just changing the build setting that controls ARC? It sounds like there are no source code changes. Unless you’ve done something

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Beinan Li
Sorry, I didn't make it clearer. My code used to manage memory without ARC. Then I converted everything to using ARC. The conversion was done automatically via Xcode, with only a few hand edits. It worked without issues with Xcode 6.0.x. By turning off ARC, I meant that I reverted to the revision

Re: Crash with ARC enabled on Xcode 6.1

2014-10-22 Thread Beinan Li
Oh! I did actually. The method I posted belongs to an ObjC object which is wrapped by a C++ object. That C++ object is a singleton (static). How is this going to affect ARC and why it didn't down-right crash a week ago before I upgraded Xcode? Thanks, Beinan On Wed, Oct 22, 2014 at 7:00 PM,