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

  • undo all changes made in the child view controller
  • How would you minimize or compress Core Data sqlite file size?
  • Swift 3 Core Data Delete Object
  • What is the maximum size of SQLite or Core Data database on iOS?
  • CoreData could not fulfill a fault for
  • How to sort a fetch in Core Data
  • 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?

    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:

    https://developer.apple.com/library/mac/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html

    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;
    

    // Works:

    @property (getter=theNewTitle) NSString *newTitle;