Objective-C NSString(if-statement) - 未识别的行为?

时间:2015-04-13 19:17:54

标签: objective-c if-statement command-line nsstring

Xcode调试器说我的Obj-C命令行程序在我的if语句的'第10行'中有一个未识别的行为。请帮忙!

#import <Foundation/Foundation.h>

int main() {

printf("\n\n What language is used to program Mac OS X / iOS applications? \n\n");
char answer [60];
scanf("%s", answer);

NSString * userInput = [[NSString alloc] initWithCString: answer encoding: NSUTF8StringEncoding];
if (userInput == @"Objective-C") {

    NSLog(@"\n\n Did you know Apple made a new language to replace %@? \n\n", userInput);
    NSLog(@"\n\n It's called Swift! \n\n");}

return 0;}

0 个答案:

没有答案