Application crashes if a property name starts with new
In my project I’m using coredata. One of the entity has an attribute named newTotal, in its corresponding NSManagedObject class the property declaration is like
@property (nonatomic, strong) NSString *newTotal;
If I add a property like this in an NSObject subclass the XCode will show an error like
error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects
But in NSManaged object subclasses it’s not showing the error but the application crashes when the property is accessed, something saying like EXC_BAD_ACCESS.
Why XCode not showing error but application crashes?. Is this a bug with XCode/clang/LLVM ?
I know its something related to the synthesize. NSManagedObject sub classes not synthesizing the property in it, but the @dynamic directive just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass or will be provided at runtime). But I have no clear Idea about this. Can anybody can give a clear idea about the problem?
- Core Data Deletion rules and many-to-many relationships
- Pass core data entity variable between views
- core data changes don't merge
- NSFetchedResultsController XCode 7 issue
- Setting a different section for each month with fetchedresultcontroller
- Xcode modifies current CoreData model version at every launch
Solutions Collect From Internet About “Application crashes if a property name starts with new”
I can see you are using ARC.
In ARC memory is managed for you, but there are few things you can/have to do yourself. You cannot name property “newXxxx” because:
You cannot give an accessor a name that begins with new. This in turn means that you can’t, for example, declare a property whose name begins with new unless you specify a different getter:
// Won’t work:
@property NSString *newTitle;
@property (getter=theNewTitle) NSString *newTitle;
- parse JSON string into array of objects Objective C
- iOS – Detect Blow into Mic and convert the results! (swift)
- NSEvent addGlobalMonitorForEventsMatchingMask: Hotkey Intercepting
- Notification of cancellation of auto-renewal for an in-app purchase
- KVO Notifications for a Modification of an NSArray backed by a NSMutableArray
- How are string constants in Objective-C stored/retrieved?
- NSString retain Count
- No “Done” button on AVPlayerViewController
- How can I get a list of the available NSFont families?
- Can I write Java code in XCode 3.2.1?
- Release one iOS app with multiple (foreign lang.) names?
- Converting a CURL command for Objective C
- Why isn't there Xcode for Windows?
- Fitting UIBezierPath/CGPath to circle
- Check string for nil & empty