Lior Pollak
Lior Pollak

Reputation: 3450

Troubles in compiling (iPhone Dev)

I compiled my app and I am having this error- Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

plus I want to notify the user about what he's going to post. I tried this-

NSString *someText = textForSharing;
    UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Confirm" message:(@"Are you sure you want to post %@ on your facebook wall?", *someText) delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];

But it gives me- error:Experession result unused and error: Sending 'NSString' to parameter of incompatible type 'NSString *'

What should I do? Thanks in advance!

Upvotes: 0

Views: 69

Answers (3)

AAV
AAV

Reputation: 3803

Use stringWithFormat, that will solve incompatible type 'NSString *' error.

Upvotes: 0

Oleg Trakhman
Oleg Trakhman

Reputation: 2082

First, expression

(@"Are you sure you want to post %@ on your facebook wall?", *someText)

returns (*sometext) which is of type (NSString) but format modifier %@ requires a pointer to object ("id" which is basically pointer to an NSObject)

Second, if you use format, you need function/selctor to parse this format (NSLog() or +[NSString stringWithFormat: (NSString*)format] or c-style sprintf(), etc )

Upvotes: 1

Mathieu Hausherr
Mathieu Hausherr

Reputation: 3485

From where come this syntax?

(@"Are you sure you want to post %@ on your facebook wall?", *someText)

Try with

[NSString stringWithFormat:@"Are you sure you want to post %@ on your facebook wall?", someText];

Upvotes: 1

Related Questions