Reputation: 5157
I have a non-ARC project that I added a new file to and set an ARC compiler flag (-fobjc-arc) for. When I make calls to [object release]; in the file, there are no compiler errors thrown. I need to be sure that this file indeed has ARC enabled, how can I prove that? Thanks.
Upvotes: 0
Views: 141
Reputation: 912
There is no check for ARC at runtime. However, you can check it at compile time:
#if !__has_feature(objc_arc)
//Do the old stuff
#endif
Hope that helps.
Upvotes: 6
Reputation: 104145
Additionally, if you can call -release
, ARC is off. Once turned on, the compiler will complain about any attempt at manual memory management, like calling -retain
, -release
or [super dealloc]
.
Upvotes: 1
Reputation: 6587
Try this
#if __has_feature(objc_arc)
// ARC is On
NSLog(@"ARC on");
#else
// ARC is Off
NSLog(@"ARC off");
#endif
Hope it helps you..
Upvotes: 0