Normally, you should return an auto-implemented object from the Objective-C method, which returns a new object. It's easy enough to do this with Core Foundation objects. For example, take this base class method:
+ (CFURLRef)appleWebsiteURL
{
CFURLRef url = CFURLCreateWithString(NULL,CFSTR("http://apple.com"),NULL);
return (CFURLRef)[NSMakeCollectable(url) autorelease];
}
, , . iPhone, :
return (CFURLRef)[(NSObject*)url autorelease];