Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Last end of my wits! Help! (XCODE OSX, basic app nightmare)

Hi Folks,


I literally spent an entire night trying to solve this...scoured the net/read tons of cryptic

articles. I really am on my last braincell here and would appreciate if someone can help me.


I am trying to create a simple app in OSX where I click on a thumbnail size picture

and a random bit of text will appear.


The Interface is a simple window with a simple picture, text label. I associated everything

via the delegate...yet the code keeps giving me this error message. I read that the 'string'

needs to be modified (and this is where I start losing my hair)


Below is the code I wrote:


The Header:


#import <Cocoa/Cocoa.h>


@interface AppAppDelegate : NSObject <NSApplicationDelegate> {

@private

NSTextField *textoutput;

}


- (IBAction)button2:(id)sender;

@property (assign) IBOutletNSTextField *textoutput;


@end


And the Implement:


#import "AppAppDelegate.h"


@implementation AppAppDelegate;

@synthesize textoutput;



- (void)applicationDidFinishLaunching:(NSNotification *)aNotification

{

int randomnumber = arc4random() % 3+1;

- (IBAction)button2:(id)sender {

switch ([sender randomnumber]) {

case 1:

textoutput.text = @"Test1";

break;

case 2:

textoutput.text = @"Test2";

break;

case 3:

textoutput.text = @"Test3";

break;

case 4:

textoutput.text = @"Test4";

break;

default break;

}

}


}


@end


Highlighted in red: I keep getting a "Expected Expression" error or some other cryptic error message.


I would greatly appreciate any help/advice/corrections! Someone helped me before with a simple 'dice' game

and that help helped me beyond all comprehension in basic coding...I now want to figure out the User Interface!!!


Thanks

Posted on Apr 13, 2012 8:49 AM

Reply
17 replies

Apr 16, 2012 7:23 AM in response to etresoft

"Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ usr/bin/clang failed with exit code 1"


I found using XCODE 4.0.2 on my 10.6.8 Mac Pro, it works swimmingly.


However when I use 4.3.2 on my 10.7.3 MacBookPro, I'm greeted with a slew of new errors.


I'm chalking this up as a bug (on Apple's part)


I'm doing the exact same thing, and getting errors on the newer version.

Last end of my wits! Help! (XCODE OSX, basic app nightmare)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.