Converting to Arc → undeclared identifier
Trying to convert an older project to Arc, Xcode complains about Use of undeclared identifier '_privateDate'. And threatens that nothing will be done unless I fix this first. Well - for one: without Arc there are no undeclared identifiers. (Builds without error or warnings). The class with problems looks like: @interface SomeClass( ) @property (strong) NSDate *privateDate; @end @implementation SomeClass - (id)initAt:(NSDate *)someDate ; { self = [ super init ]; if ( self == nil ) return nil; _privateDate = [ someDate retain ]; return self ; } ... some other stuff omitted ... @end I always thought that using accessors (like self.privateDate) in init methods was NOT a good idea, because at this point the thing might not be completely initialised and functional, so one had better use _privateDate directly. And the accessor methods like setPrivateDate: might rely on a completely functional object. Is this correct? How to placate Xcode? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
You're missing an @synthesize privateData = _privateData; in your @implementation, would be my guess. On Aug 20, 2013, at 1:07 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: Trying to convert an older project to Arc, Xcode complains about Use of undeclared identifier '_privateDate'. And threatens that nothing will be done unless I fix this first. Well - for one: without Arc there are no undeclared identifiers. (Builds without error or warnings). The class with problems looks like: @interface SomeClass( ) @property (strong) NSDate *privateDate; @end @implementation SomeClass - (id)initAt:(NSDate *)someDate ; { self = [ super init ]; if ( self == nil ) return nil; _privateDate = [ someDate retain ]; return self ; } ... some other stuff omitted ... @end I always thought that using accessors (like self.privateDate) in init methods was NOT a good idea, because at this point the thing might not be completely initialised and functional, so one had better use _privateDate directly. And the accessor methods like setPrivateDate: might rely on a completely functional object. Is this correct? How to placate Xcode? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/witness.of.teachtext%40gmx.net This email sent to witness.of.teacht...@gmx.net Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 20 Aug 2013, at 19:24, Uli Kusterer witness.of.teacht...@gmx.net wrote: You're missing an @synthesize privateData = _privateData; in your @implementation, would be my guess. There is no @synthesize, this is true. But Xcode normally does not mind, and I think this is (since when?) no longer necessary (maybe only in 64 bit?). On Aug 20, 2013, at 1:07 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: Trying to convert an older project to Arc, Xcode complains about Use of undeclared identifier '_privateDate'. And threatens that nothing will be done unless I fix this first. Well - for one: without Arc there are no undeclared identifiers. (Builds without error or warnings). The class with problems looks like: @interface SomeClass( ) @property (strong) NSDate *privateDate; @end @implementation SomeClass - (id)initAt:(NSDate *)someDate ; { self = [ super init ]; if ( self == nil ) return nil; _privateDate = [ someDate retain ]; return self ; } ... some other stuff omitted ... @end I always thought that using accessors (like self.privateDate) in init methods was NOT a good idea, because at this point the thing might not be completely initialised and functional, so one had better use _privateDate directly. And the accessor methods like setPrivateDate: might rely on a completely functional object. Is this correct? How to placate Xcode? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 20/08/2013, at 9:07 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: How to placate Xcode? Are you sure it's not the use of retain that it's complaining about? Without that, your code compiles fine here. -- Shane Stanley sstan...@myriad-com.com.au 'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
Sure, but the whole point the OP is trying to make is that the purported error is being raised by the refactoring process that is _supposed to remove that retain_. Refactoring would be a very easy process indeed if doing the conversion yourself is a prerequisite of having Xcode do it. The use of the _ivar should work ― did work as far as the production compiler knew. Is the code the OP posted the whole context? Has he tried to convert that minimal example, and gotten the same error? Has he examined the preprocessed code (and then searched for the no-underscore name of the @property) to see if anything suggests itself? ― F On Aug 20, 2013, at 8:12 AM, Shane Stanley sstan...@myriad-com.com.au wrote: On 20/08/2013, at 9:07 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: How to placate Xcode? Are you sure it's not the use of retain that it's complaining about? Without that, your code compiles fine here. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 20 Aug 2013, at 20:27, Fritz Anderson anderson.fr...@gmail.com wrote: Sure, but the whole point the OP is trying to make is that the purported error is being raised by the refactoring process that is _supposed to remove that retain_. Refactoring would be a very easy process indeed if doing the conversion yourself is a prerequisite of having Xcode do it. The use of the _ivar should work ― did work as far as the production compiler knew. Is the code the OP posted the whole context? Has he tried to convert that minimal example, and gotten the same error? Has he examined the preprocessed code (and then searched for the no-underscore name of the @property) to see if anything suggests itself? Created a new project (not document based) removed arc in build settings, modified the AppDelegate thus: #import T1AppDelegate.h @interface T1AppDelegate () @property (strong) NSDate *myDate; @end @implementation T1AppDelegate - initWithDate: (NSDate*)aDate { self = [super init]; if ( self == nil ) return nil; _myDate = [ aDate retain]; return self; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application } @end Nothing edited (except some comments at the very top). Builds without errors. As expected. Tried Edit → Refactor → Convert to Objective-C ARC Got: Xcode found 1 issue that prevents conversion from proceeding. Fix all ARC readiness issues and try again. The offending line is: _myDate = [ aDate retain]; Adorned with the remark Use of undeclared identifier '_myDate' Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
This looks like a bug in Xcode’s refactoring tool — seems it doesn’t understand the auto-synthesize feature. I would take your test case and attach it to a new Radar bug report to Apple. The workaround should be to add an explicit instance variable declaration and an “@synthesize” directive where needed. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 20 Aug 2013, at 21:41, Jens Alfke j...@mooseyard.com wrote: This looks like a bug in Xcode’s refactoring tool — seems it doesn’t understand the auto-synthesize feature. I would take your test case and attach it to a new Radar bug report to Apple. Just done this. Bug 14784266. Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On Aug 20, 2013, at 8:43 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 20 Aug 2013, at 20:27, Fritz Anderson anderson.fr...@gmail.com wrote: Sure, but the whole point the OP is trying to make is that the purported error is being raised by the refactoring process that is _supposed to remove that retain_. Refactoring would be a very easy process indeed if doing the conversion yourself is a prerequisite of having Xcode do it. The use of the _ivar should work ― did work as far as the production compiler knew. Is the code the OP posted the whole context? Has he tried to convert that minimal example, and gotten the same error? Has he examined the preprocessed code (and then searched for the no-underscore name of the @property) to see if anything suggests itself? Created a new project (not document based) removed arc in build settings, modified the AppDelegate thus: What version of Xcode? I just tried this with Xcode 4.6.3 and it worked perfectly. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 20 Aug 2013, at 21:54, glenn andreas gandr...@me.com wrote: On Aug 20, 2013, at 8:43 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 20 Aug 2013, at 20:27, Fritz Anderson anderson.fr...@gmail.com wrote: Sure, but the whole point the OP is trying to make is that the purported error is being raised by the refactoring process that is _supposed to remove that retain_. Refactoring would be a very easy process indeed if doing the conversion yourself is a prerequisite of having Xcode do it. The use of the _ivar should work ― did work as far as the production compiler knew. Is the code the OP posted the whole context? Has he tried to convert that minimal example, and gotten the same error? Has he examined the preprocessed code (and then searched for the no-underscore name of the @property) to see if anything suggests itself? Created a new project (not document based) removed arc in build settings, modified the AppDelegate thus: What version of Xcode? I just tried this with Xcode 4.6.3 and it worked perfectly. A difficult question: I am not allowed to talk about this (which might give you an idea, which version I was using). Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
Actually, I think the question is what version of Xcode are you upgrading the project from and what version of Xcode are you using to do the conversion? That way, it's much easier to pin down the specific case that might be causing this. - Alex Zavatone On Aug 20, 2013, at 10:57 AM, glenn andreas gandr...@me.com wrote: On Aug 20, 2013, at 8:43 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 20 Aug 2013, at 20:27, Fritz Anderson anderson.fr...@gmail.com wrote: Sure, but the whole point the OP is trying to make is that the purported error is being raised by the refactoring process that is _supposed to remove that retain_. Refactoring would be a very easy process indeed if doing the conversion yourself is a prerequisite of having Xcode do it. The use of the _ivar should work ― did work as far as the production compiler knew. Is the code the OP posted the whole context? Has he tried to convert that minimal example, and gotten the same error? Has he examined the preprocessed code (and then searched for the no-underscore name of the @property) to see if anything suggests itself? Created a new project (not document based) removed arc in build settings, modified the AppDelegate thus: What version of Xcode? I just tried this with Xcode 4.6.3 and it worked perfectly. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Converting to Arc → undeclared identifier
On 21/08/2013, at 12:59 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: What version of Xcode? I just tried this with Xcode 4.6.3 and it worked perfectly. A difficult question: I am not allowed to talk about this (which might give you an idea, which version I was using). Worked fine for me in an unmentionable version, FWIW. -- Shane Stanley sstan...@myriad-com.com.au 'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com