NSManagedObject Incompatible pointer type warnings
Let me make sure first I have X-Code 4.3.2 version and iOS 5.1 SDK. I have below methods used in my project for core-data operation. Both method giving same warning. i.e **"Incompatible pointer types returning 'NSManagedObject *' from a function with result type 'NSManagedObject <<protcolname>Protocol> "**.

**Method A:**

    - (NSManagedObject<Protocol> *)newMOforNilMOC 
    {
    	return [[NSManagedObject alloc] initWithEntity:[self entityDescription] insertIntoManagedObjectContext:nil];
    }

For method **method A** I just do typecasting and added (NSManagedObject<<Protocol>Protocol>*) then warning get removed as stated below. 

    - (NSManagedObject<Protocol> *)newMOforNilMOC 
    {
    	return  (NSManagedObject<Protocol> *) [[NSManagedObject alloc] initWithEntity:[self entityDescription] insertIntoManagedObjectContext:nil];
    }

**Method B:**
   

    + (NSManagedObject<Protocol> *) newInContext:(NSManagedObjectContext *)context 
        {	
        	return [[NSEntityDescription insertNewObjectForEntityForName:[[(NSManagedObject<Protocol> *)self class] entityName]    									inManagedObjectContext:context]retain];	
        }

For **method B** when I do typecasting it will not work hence I just change the name of method from newInContext to AddnewInContext (Found somewhere when googled) then warning got removed.

I have following Questions:
1.If first method is required typecasting then why second one is not working with that solution? 
2. What is the exact meaning of changing the name of method. Is this proper way to remove above warning? Why typecasting not working in **method B**?
 
This could be complicated one but feel free to leave comment if you have any doubt. Because I want to know the difference, at least I get to learn some new thing about core data.

NSManagedObject Incompatible pointer type warnings
===

Let me make sure first I have X-Code 4.3.2 version and iOS 5.1 SDK. I have below methods used in my project for core-data operation. Both method giving same warning. i.e **"Incompatible pointer types returning 'NSManagedObject *' from a function with result type 'NSManagedObject <<protcolname>Protocol> "**.

**Method A:**

    - (NSManagedObject<Protocol> *)newMOforNilMOC 
    {
    	return [[NSManagedObject alloc] initWithEntity:[self entityDescription] insertIntoManagedObjectContext:nil];
    }

For method **method A** I just do typecasting and added (NSManagedObject<<Protocol>Protocol>*) then warning get removed as stated below. 

    - (NSManagedObject<Protocol> *)newMOforNilMOC 
    {
    	return  (NSManagedObject<Protocol> *) [[NSManagedObject alloc] initWithEntity:[self entityDescription] insertIntoManagedObjectContext:nil];
    }

**Method B:**
   

    + (NSManagedObject<Protocol> *) newInContext:(NSManagedObjectContext *)context 
        {	
        	return [[NSEntityDescription insertNewObjectForEntityForName:[[(NSManagedObject<Protocol> *)self class] entityName]    									inManagedObjectContext:context]retain];	
        }

For **method B** when I do typecasting it will not work hence I just change the name of method from newInContext to AddnewInContext (Found somewhere when googled) then warning got removed.

I have following Questions:
1.If first method is required typecasting then why second one is not working with that solution? 
2. What is the exact meaning of changing the name of method. Is this proper way to remove above warning? Why typecasting not working in **method B**?
 
This could be complicated one but feel free to leave comment if you have any doubt. Because I want to know the difference, at least I get to learn some new thing about core data.
