Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 19, 2013, 07:00 AM   #1
Ja Di ksw
macrumors 65816
 
Join Date: Apr 2003
Send a message via AIM to Ja Di ksw
Apple 's tutorial not working, worth it to follow anyway?

Hi everyone. Apple give a tutorial for learning how to make some apps, but it doesn't seem to work with the latest version of Xcode, which is giving me errors even running a blank app! I'll explain:

I'm pretty much brand new at programming (I wrote a bunch of stuff in NetLogo a few years ago, and a *tiny* bit in Matlab way before that, but yeah, very very new). I want to learn Objective-C for what an app that won't be crazy complex, but also won't be the simplest thing in the world. To help, I've been reading Kochan's book on Objective-C programming.

Anyways, I went to Apple's tutorial (https://developer.apple.com/library/...roduction.html) and started to do it simultaneously with Kochan's book.

Right off the bat, the tutorial tells you to create a new app and just hit run with it blank. Then it starts with simple sliders / text box / button connections. So, I had no problem doing the work on the sliders and whatnot, but hitting run (even before doing ANYTHING) returns a list of 11 errors. Everything is in Frameworks/Other Frameworks/AppKit.framework. For example, in Frameworks/Other Frameworks/AppKit.framework/Headers/NSCell.h there are two lines that both give the error "Expected a type". The lines are:

Code:
- (NSUserInterfaceLayoutDirection)userInterfaceLayoutDirection NS_AVAILABLE_MAC(10_6);
- (void)setUserInterfaceLayoutDirection:(NSUserInterfaceLayoutDirection)layoutDirection NS_AVAILABLE_MAC(10_6);
So, is it even worth it to try with Apple's tutorial? I'm not sure why things are failing to run even before I enter any code, but I'm not sure how I'm going to get past problems located in the AppKit with my level of experience.

Thanks for any feedback!
__________________
Fetch Daddy's blue fright wig! I must be handsome when I unleash my rage.

Last edited by dejo; Sep 25, 2013 at 11:08 AM. Reason: please use [code] tags.
Ja Di ksw is offline   0 Reply With Quote
Old Sep 19, 2013, 09:51 AM   #2
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
I'm guessing the error is in how you created the app, or configuration of Xcode or something.
robvas is offline   0 Reply With Quote
Old Sep 19, 2013, 11:08 PM   #3
PatrickCocoa
macrumors 6502a
 
Join Date: Dec 2008
Start at the beginning

I can't quite tell what's going on with your setup, but the template applications provided in Xcode will run. First time. Right out of the box.

If one of those templates doesn't run, you need to get that figured out before doing anything else. My suggestions:

1. Restart your computer.
2. Download Xcode from the Mac Apple Store.
3. Start Xcode. Select Create New Xcode Project. Select OS X / Application / Cocoa Application. Enter:
product name: test01
organization name: robvas
company identifier: com.robvas.software
class prefix: RBV
app store category: none
create document based application: (unchecked)
use core data: (unchecked)
select: OK
create git repository: (checked)
select: create
Press the play button. The application will run.

You MUST do each step above exactly. Exactly means exactly.

If you do the above and it doesn't work, post EXACTLY what you did. If you are dead sure that you don't need Xcode from MAS and you used a copy of Xcode you got from some friend at uni, tell us. If you're not using a Mac but some kind of hackintosh, tell us. If you're running 10.3.3 because of whatever, tell us.
__________________
iMac 21.5", 3.06GHz, 4 GB, 2 TB HD.
iPod Touch 3G.
PatrickCocoa is offline   1 Reply With Quote
Old Sep 20, 2013, 07:26 AM   #4
Ja Di ksw
Thread Starter
macrumors 65816
 
Join Date: Apr 2003
Send a message via AIM to Ja Di ksw
Thanks for the in-depth help, that got it working.

I'm somewhat curious about why though... The product name and organization were different, but that shouldn't matter. Everything else I had the same except the company identifier and class prefix which were different, but I just made another test with a non-"com.etc" identifier and no class prefix and it worked...

Anyways, no idea how that fixed it, would be interested to know but glad it did work in any case. Thank you!
__________________
Fetch Daddy's blue fright wig! I must be handsome when I unleash my rage.
Ja Di ksw is offline   0 Reply With Quote
Old Sep 20, 2013, 10:22 AM   #5
PatrickCocoa
macrumors 6502a
 
Join Date: Dec 2008
I forgot to mention . . .

Quote:
Originally Posted by Ja Di ksw View Post
Anyways, no idea how that fixed it, would be interested to know but glad it did work in any case. Thank you!
I forgot to mention that Xcode can read your mind - it's looking for negative thoughts. So if you're in a bad mood or don't like the new iPhone 5s or your spouse just left you, Xcode will add spurious errors to your code.
__________________
iMac 21.5", 3.06GHz, 4 GB, 2 TB HD.
iPod Touch 3G.
PatrickCocoa is offline   0 Reply With Quote
Old Sep 21, 2013, 04:28 AM   #6
Ja Di ksw
Thread Starter
macrumors 65816
 
Join Date: Apr 2003
Send a message via AIM to Ja Di ksw
That makes perfect sense! Happy with my brand new wife (3 weeks today!), but definitely in a "wtf is up with trying to learn Objective-C!" mood.....
__________________
Fetch Daddy's blue fright wig! I must be handsome when I unleash my rage.
Ja Di ksw is offline   0 Reply With Quote
Old Sep 24, 2013, 03:45 PM   #7
devilofspades
macrumors member
 
Join Date: Jul 2011
i can tell you right off the bat, if you plan on learning "objective-c" and sticking with it for any time other than a single one off program...with out a doubt learn about c first. i will explain in a somewhat lengthy but understandable reason.

"objective-c" and "apple frameworks" are not one and the same. it's like calling a loaf of bread and some meat, a sandwich. objective-c is like a dictionary, but apple's "cocoa" & "cocoa touch" frameworks are like the grammer that puts it all together to make a sentance or a novel. on top of that, some apple frameworks are objective-c based, but the reality is most of the important ones are all c based. ones like core animation (making pretty transitions and things move) & core graphics (making pretty drawings and images). objective-c in itself is not that hard to pick up, and it's a relatively eligant language. however it is a strict superset of c. what this means is unlike other languages like c#, pure c code and objective-c code can innermingle with each other and does so very often. with out understanding the different primative types and the components of c, some parts of the apple frameworks are not going to make sense and you will end up just copy and pasting code you googled and will have no clue what it means or how it works. the bottom line is objective-c is just c under the hood. all the high level apple api is just making c function calls for you at a lower level. what ever book you plan on getting or using, do yourself a favor and don't gloss over the c section. it will pay you back 10 fold in the future i can assure you. also, get a couple books. not every author's writing style clicks with every reader. having multiple explinations of the same topic can never hurt and will only help solidify your understanding. this applies to the c level and the objective-c level.
devilofspades is offline   1 Reply With Quote
Old Sep 27, 2013, 01:53 PM   #8
MeUnix
macrumors 6502
 
Join Date: Aug 2013
Location: San Francisco
Quote:
Originally Posted by devilofspades View Post
i can tell you right off the bat, if you plan on learning "objective-c" and sticking with it for any time other than a single one off program...with out a doubt learn about c first. i will explain in a somewhat lengthy but understandable reason.

"objective-c" and "apple frameworks" are not one and the same. it's like calling a loaf of bread and some meat, a sandwich. objective-c is like a dictionary, but apple's "cocoa" & "cocoa touch" frameworks are like the grammer that puts it all together to make a sentance or a novel. on top of that, some apple frameworks are objective-c based, but the reality is most of the important ones are all c based. ones like core animation (making pretty transitions and things move) & core graphics (making pretty drawings and images). objective-c in itself is not that hard to pick up, and it's a relatively eligant language. however it is a strict superset of c. what this means is unlike other languages like c#, pure c code and objective-c code can innermingle with each other and does so very often. with out understanding the different primative types and the components of c, some parts of the apple frameworks are not going to make sense and you will end up just copy and pasting code you googled and will have no clue what it means or how it works. the bottom line is objective-c is just c under the hood. all the high level apple api is just making c function calls for you at a lower level. what ever book you plan on getting or using, do yourself a favor and don't gloss over the c section. it will pay you back 10 fold in the future i can assure you. also, get a couple books. not every author's writing style clicks with every reader. having multiple explinations of the same topic can never hurt and will only help solidify your understanding. this applies to the c level and the objective-c level.
I agree with this 100%. When I first started programming, I jumped right into Objective-C without really knowing anything about C. I had some mentors tell me to take the extra time and learn C first instead, which I did, and it has proven to pay off, like you said.
__________________
13" ALUM MacBook, 2.0 GHz, 6 GB RAM, 120 GB SSD, OS X 10.9 Mavericks ; 13" ALUM MacBook, 2.0 GHz, 4 GB RAM, 160 GB HDD, OS X 10.8.5 ML iPhone 4S 16GB iOS 7.0.2
MeUnix is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Samsung Said to Follow Apple's Lead with Fingerprint Sensor, No Iris Scanner in Galaxy S5 MacRumors MacRumors.com News Discussion 165 Jan 23, 2014 02:10 PM
Amazon introducing its own currency. I expect Apple to follow. PracticalMac Apple, Industry and Internet Discussion 17 Feb 11, 2013 04:00 PM
VirnetX Files Follow-Up Patent Lawsuit Targeting Apple's Latest Products MacRumors iOS Blog Discussion 36 Nov 14, 2012 02:21 PM
Fair Labor Association Finds Progress in Follow-Up Status Report on Foxconn's Apple Facilities MacRumors MacRumors.com News Discussion 35 Aug 22, 2012 02:36 PM
phones: Switched to SSGS3: an Apple Girl's perspective (Part II Follow up) Wrathwitch Alternatives to iOS and iOS Devices 50 Jul 14, 2012 11:37 PM

Forum Jump

All times are GMT -5. The time now is 07:27 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC