2013-05-05 41 views
1
- (IBAction) createAccount: (id) sender { 

NSString *post =[NSString stringWithFormat:@」name=%@&password=%@&email=%@」,nameField.text, passwordField.text, emailField.text]; 

NSString *hostStr = @」domain.tk/in-app/account/create-account.php?」; 
hostStr = [hostStr stringByAppendingString:post]; 
NSData *dataURL = [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]]; 
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding]; 







if([serverOutput isEqualToString:@」Yes」]){ 


    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@」Congrats」 message:@」Your account has bee succesfully created. 「 
                  delegate:self cancelButtonTitle:@」OK」 otherButtonTitles:nil, nil]; 

    [alertsuccess show]; 
    [alertsuccess release]; 


} else { 
    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@」Error」 message:@」We are sorry, but an error has been encountered, please try agian later.」 
                  delegate:self cancelButtonTitle:@」OK」 otherButtonTitles:nil, nil]; 
    [alertsuccess show]; 
    [alertsuccess release]; 

} 

} 

我得到幾乎有線的錯誤,有一個@,我該如何解決這個問題?我(想我)合成了所有的字段,並在@interface中做了IBOutlet,並且在@interface下給了他們@屬性。我無法弄清楚如何解決這個問題,我錯過了什麼!爲什麼這段代碼給我錯誤:「程序中意外的@」?

+0

你肯定你」重新編譯爲目標c?該文件是否具有「.m」文件擴展名? – Dave 2013-05-05 15:57:27

+0

是的,我使用File> New File> Objective-C Class創建了它。 – 2013-05-05 15:59:38

回答

6

在你的代碼的常規報價"更換印刷報價應該幫助:-)

(如果您從PDF文檔中複製/粘貼代碼,如能可能發生。)

+0

我愛你:)愚蠢的複製和粘貼。 – 2013-05-05 16:03:08

相關問題