0

I'm creating an app for OS X, and it's basically finished. To test it out, I have tried it on other macs. I have tried several methods of sending the app to the other macs, but they end up with the same result. The methods include sending the .app file found in the Products folder, or sending an archived version of the app.

This works for some macs, like my laptop, and 2 others I have used. However, for 1 particular laptop belonging to my friend the app does not launch properly. The app appeared in the dock for half a second before it closed itself with an error report.

I looked at it, and the only thing I could understand was the following phrase:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0x104807258'
terminating with uncaught exception of type NSException
abort() called

I checked my code, and found the method labelNodeWithText: only once in the code which is actually outside of the code of any methods:

@implementation GameScene

SKLabelNode *mousePosition = [SKLabelNode labelNodeWithText:@"Mouse Clicked Position: (0, 0)"];

..............

@end

(The reason I can do this is because the file is a .mm file rather than a .m file.)

So I tried taking the line of code inside of the didMoveToView: method and sure enough, when the app launched on my friends computer again it didn't crash. Yet the app was still bugged as the only thing on the screen was this SKLabelNode, whilst all of the other Nodes which were meant to be there were not there.

I have no idea what is causing this problem. The target for deployment is 10.9 which is lower than the versions on all of the macs I have tested on. The only difference I can think of between the macs is that my friend's mac does not have Xcode on it (which he cannot download for now until he updates to 10.10).

I have read similar issues (only 2 could be found online) which other people have experienced, yet none of the answers/solutions provided have worked for me. This is not the only app which I have experienced these issues with with my friend's computer as I have tried 2 in the past with similar results.

Can someone please help me with this problem?

Larme
  • 24,190
  • 6
  • 51
  • 81
Shuri2060
  • 729
  • 6
  • 21
  • 1
    Nothing to do with having or not the last XCode version (hopefully, else, when every one using an app should have XCode): `labelNodeWithText:` is `Available in OS X v10.10 and later.` Not on 10.9. – Larme Jan 24 '16 at 11:22
  • Ok thank you. I can't believe that this problem is caused simply by OS X version... Why does Xcode let me run/ use the code despite the target being 10.9? – Shuri2060 Jan 24 '16 at 11:28
  • 1
    It doesn't check it. Because you could in case if not available go into an alternative version, using `respondsToSelector:` for example, giving the last super cool tools to last version only. I develop iOS app, so I'll give you an understandable example: like using the 3D Touch only for iPhone 6S (Plus)., if you don't have it, what do you do, etc (note, that's may be not the most fitting example in terms of coding, but understandable in term of capacities/availabilities). See how to work with multiples OS versions and compatibilties to get more infos about it. – Larme Jan 24 '16 at 11:34
  • Ok that makes a lot of sense to me now thanks ! – Shuri2060 Jan 24 '16 at 11:39

1 Answers1

1

labelNodeWithText: class method of SKLabelNode is only available since 10.10 on Mac OS X. Even if SKLabelNode appeared in 10.9, some methods don't, like labelNodeWithText:.

It you look at the doc of labelNodeWithText: you'll see it clearly:

Availability
Available in OS X v10.10 and later.

It's not related to having or not the last version of XCode. Imagine if each person downloading an app should have to install XCode, that's hopefully not necessary.

Larme
  • 24,190
  • 6
  • 51
  • 81
  • Ok thank you. I'm guessing this is true for most Sprite Kit stuff as the sprites didn't show up either. – Shuri2060 Jan 24 '16 at 11:40