TARGET_OS_MAC section generates a compile error on an iPhone project?
Hello, I have code that's part of a framework and I'd like to port it to iOS. I tried isolating the code like so: // // RootViewController.m // iPhoneTest #import RootViewController.h @implementation RootViewController #pragma mark - #pragma mark View lifecycle - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (NSUInteger)systemPageSize { static NSUInteger __sSystemPageSize = NSNotFound; #if TARGET_OS_MAC if (NSNotFound == __sSystemPageSize) { NSTask *task = [[NSTask alloc] init]; // do something here... [task release]; } #elif TARGET_OS_IPHONE // do something here... #endif return __sSystemPageSize; } When I compile the standard iPhone boilerplate app from Xcode I get the following error: /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m: In function '-[RootViewController systemPageSize]': /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'NSTask' undeclared (first use in this function) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: (Each undeclared identifier is reported only once /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: for each function it appears in.) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'task' undeclared (first use in this function) {standard input}:59:non-relocatable subtraction expression, L_OBJC_SELECTOR_REFERENCES_0 minus L001$pb {standard input}:59:symbol: L_OBJC_SELECTOR_REFERENCES_0 can't be undefined in a subtraction expression {standard input}:54:non-relocatable subtraction expression, L_OBJC_CLASSLIST_SUP_REFS_$_0 minus L001$pb {standard input}:54:symbol: L_OBJC_CLASSLIST_SUP_REFS_$_0 can't be undefined in a subtraction expression {standard input}:unknown:Undefined local symbol L_OBJC_CLASSLIST_SUP_REFS_$_0 {standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_0 I know NSTask doesn't exist on iOS, so I was hoping to implement the method that would work for both Mac and iOS by specifying TARGET_OS_MAC and TARGET_OS_IPHONE. What am I missing? Thanks, -- Tito ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: TARGET_OS_MAC section generates a compile error on an iPhone project?
Read this: http://sealiesoftware.com/blog/archive/2010/8/16/TargetConditionalsh.html --Kyle Sluder (Sent from the road) On Aug 27, 2010, at 1:47 PM, Tito Ciuro tci...@mac.com wrote: Hello, I have code that's part of a framework and I'd like to port it to iOS. I tried isolating the code like so: // // RootViewController.m // iPhoneTest #import RootViewController.h @implementation RootViewController #pragma mark - #pragma mark View lifecycle - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (NSUInteger)systemPageSize { static NSUInteger __sSystemPageSize = NSNotFound; #if TARGET_OS_MAC if (NSNotFound == __sSystemPageSize) { NSTask *task = [[NSTask alloc] init]; // do something here... [task release]; } #elif TARGET_OS_IPHONE // do something here... #endif return __sSystemPageSize; } When I compile the standard iPhone boilerplate app from Xcode I get the following error: /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m: In function '-[RootViewController systemPageSize]': /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'NSTask' undeclared (first use in this function) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: (Each undeclared identifier is reported only once /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: for each function it appears in.) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'task' undeclared (first use in this function) {standard input}:59:non-relocatable subtraction expression, L_OBJC_SELECTOR_REFERENCES_0 minus L001$pb {standard input}:59:symbol: L_OBJC_SELECTOR_REFERENCES_0 can't be undefined in a subtraction expression {standard input}:54:non-relocatable subtraction expression, L_OBJC_CLASSLIST_SUP_REFS_$_0 minus L001$pb {standard input}:54:symbol: L_OBJC_CLASSLIST_SUP_REFS_$_0 can't be undefined in a subtraction expression {standard input}:unknown:Undefined local symbol L_OBJC_CLASSLIST_SUP_REFS_$_0 {standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_0 I know NSTask doesn't exist on iOS, so I was hoping to implement the method that would work for both Mac and iOS by specifying TARGET_OS_MAC and TARGET_OS_IPHONE. What am I missing? Thanks, -- Tito ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/kyle.sluder%40gmail.com This email sent to kyle.slu...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: TARGET_OS_MAC section generates a compile error on an iPhone project?
On Aug 27, 2010, at 10:47 AM, Tito Ciuro wrote: - (NSUInteger)systemPageSize { static NSUInteger __sSystemPageSize = NSNotFound; #if TARGET_OS_MAC if (NSNotFound == __sSystemPageSize) { NSTask *task = [[NSTask alloc] init]; // do something here... [task release]; } #elif TARGET_OS_IPHONE // do something here... #endif return __sSystemPageSize; } There is no reason to use NSTask for this on the desktop. Just call getpagesize() on either platform. -- David Duncan ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: TARGET_OS_MAC section generates a compile error on an iPhone project?
Excellent! Thanks Kyle! -- Tito On 27/08/2010, at 14:02, Kyle Sluder wrote: Read this: http://sealiesoftware.com/blog/archive/2010/8/16/TargetConditionalsh.html --Kyle Sluder (Sent from the road) On Aug 27, 2010, at 1:47 PM, Tito Ciuro tci...@mac.com wrote: Hello, I have code that's part of a framework and I'd like to port it to iOS. I tried isolating the code like so: // // RootViewController.m // iPhoneTest #import RootViewController.h @implementation RootViewController #pragma mark - #pragma mark View lifecycle - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (NSUInteger)systemPageSize { static NSUInteger __sSystemPageSize = NSNotFound; #if TARGET_OS_MAC if (NSNotFound == __sSystemPageSize) { NSTask *task = [[NSTask alloc] init]; // do something here... [task release]; } #elif TARGET_OS_IPHONE // do something here... #endif return __sSystemPageSize; } When I compile the standard iPhone boilerplate app from Xcode I get the following error: /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m: In function '-[RootViewController systemPageSize]': /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'NSTask' undeclared (first use in this function) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: (Each undeclared identifier is reported only once /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: for each function it appears in.) /Users/tciuro/Desktop/iPhoneTest/Classes/RootViewController.m:23: error: 'task' undeclared (first use in this function) {standard input}:59:non-relocatable subtraction expression, L_OBJC_SELECTOR_REFERENCES_0 minus L001$pb {standard input}:59:symbol: L_OBJC_SELECTOR_REFERENCES_0 can't be undefined in a subtraction expression {standard input}:54:non-relocatable subtraction expression, L_OBJC_CLASSLIST_SUP_REFS_$_0 minus L001$pb {standard input}:54:symbol: L_OBJC_CLASSLIST_SUP_REFS_$_0 can't be undefined in a subtraction expression {standard input}:unknown:Undefined local symbol L_OBJC_CLASSLIST_SUP_REFS_$_0 {standard input}:unknown:Undefined local symbol L_OBJC_SELECTOR_REFERENCES_0 I know NSTask doesn't exist on iOS, so I was hoping to implement the method that would work for both Mac and iOS by specifying TARGET_OS_MAC and TARGET_OS_IPHONE. What am I missing? Thanks, -- Tito ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/kyle.sluder%40gmail.com This email sent to kyle.slu...@gmail.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: TARGET_OS_MAC section generates a compile error on an iPhone project?
On 27/08/2010, at 14:05, David Duncan wrote: On Aug 27, 2010, at 10:47 AM, Tito Ciuro wrote: - (NSUInteger)systemPageSize { static NSUInteger __sSystemPageSize = NSNotFound; #if TARGET_OS_MAC if (NSNotFound == __sSystemPageSize) { NSTask *task = [[NSTask alloc] init]; // do something here... [task release]; } #elif TARGET_OS_IPHONE // do something here... #endif return __sSystemPageSize; } There is no reason to use NSTask for this on the desktop. Just call getpagesize() on either platform. -- David Duncan Great to know. I'll update the code right away. Thanks Duncan, -- Tito ___ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com