2011-12-28 58 views
0

我編譯我的應用程序,我有這個錯誤 - 命令/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang失敗,退出代碼1故障彙編(iPhone開發)

再加上我想通知什麼他會發布給用戶。我想這 -

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]; 

但它給我 - 錯誤:李毅華,結果未使用的和錯誤:發送「的NSString」不兼容類型的參數「的NSString *」

我應該怎麼辦?提前致謝!

回答

1

從哪裏來的這個語法?

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

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

首先,表達嘗試

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

返回(* sometext),它是類型(的NSString) 但格式改性劑%@需要一個指向對象( 「ID」這基本上是指向一個NSObject)

第二,如果你使用的格式,您甲腎上腺素ED功能/ selctor到解析這種格式(NSLog() or +[NSString stringWithFormat: (NSString*)format]或c-風格sprintf()等)

0

使用stringWithFormat,這將解決不兼容的類型 '的NSString *' 錯誤。