ios5 ARC what is the compiler flag to exclude a file from ARC?
I found the answer: to exclude the file from ARC, use the -fno-objc-arc flag in build phases>compile sources
I found the answer: to exclude the file from ARC, use the -fno-objc-arc flag in build phases>compile sources
I had an (extensive) conversation with an Apple engineer about this crash. Here are the two most probable causes: You have an invalid constraint, such as view1.left = view2.left + 20 where view2 is unexpectedly nil, or has a multiplier of 0. Be sure to double (and triple) check your constraints to make sure that … Read more
If a variable: Is declared in a class using ARC. Is used solely for class implementation (not exposed as part of the class interface). Does not require any KVO. Does not require any custom getter/setter. Then it is appropriate to declare it as an ivar without a corresponding @property/@synthesize, and to refer to it directly … Read more
Unless there is some other reference to the parent or child, they both become orphaned. But the retain cycle between the parent and child prevent either from being released and they become wasted memory. A child should never retain a parent. If anything, use a weak reference in the child to maintain a reference to … Read more
The proposed code: __weak id weakSelf = self; timer = [NSTimer scheduledTimerWithTimeInterval:30.0f target:weakSelf selector:@selector(tick) userInfo:nil repeats:YES]; has the effect that (i) a weak reference is made to self; (ii) that weak reference is read in order to provide a pointer to NSTimer. It won’t have the effect of creating an NSTimer with a weak reference. … Read more
As I describe in my answer here, ARC can provide the best of both manual memory management and tracing garbage collection. It mostly removes the need for a developer to track manual retains, releases, and autoreleases on Objective-C objects, yet avoids the need for a garbage collector process which can use up limited resources on … Read more
Open your project and select Edit -> Refactor -> Convert to Objective-C ARC. This will start checking your code if it is ready for the conversion. See also Clang documentation: Objective-C Automatic Reference Counting (ARC) How to disable ARC has been answered here
It is still recommended to copy because you want to avoid something passing a mutable string and then changing it without you knowing. A copy guarantees that the string you have will not change.
I found the solution and it’s related to something I didn’t mention and didn’t think about: I’m compiling with Automatic Reference Counting (ARC). ARC inserts a release call to the audio player, so it’s deallocated right after leaving the method where it is created. It has nothing to do with AVAudioPlayer but with ARC. In … Read more
As Jason said, you can’t make NSArray store weak references. The easiest way to implement Emile’s suggestion of wrapping an object inside another object that stores a weak reference to it is the following: NSValue *value = [NSValue valueWithNonretainedObject:myObj]; [array addObject:value]; Another option: a category that makes NSMutableArray optionally store weak references. Note that these … Read more