标签: stringwithstring

Obj-C:[NSString stringWithString:@"string"] vs. @"string"

我见过人们做的事情[NSString stringWithString:@"some string"].为什么不@"some string"呢?

举个例子,看看facebook-ios-sdk.

+ [NSString stringWithString:] - 重点是什么?是一个类似的问题,但没有一个答案解决[NSString stringWithString:@"some string"]@"some string".

cocoa-touch objective-c nsstring ios stringwithstring

17
推荐指数
2
解决办法
3485
查看次数

Objective C stringWithFormat if语句

我对此很新 - 我正在尝试将NSString stringWithFormat与一些文本进行比较.它与stringWithString一起工作正常.我无法弄清楚为什么它不能与stringWithFormat一起使用?非常感谢任何人提供的任何帮助!

    NSString *theQuestion = [NSString stringWithFormat:@"The same thing"];
if (theQuestion == @"The same thing"){
        NSLog(@"stringWithFormat is the same as the given text");
    }else{
NSLog(@"stringWithFormat is NOT the same as the given text");
        NSLog(@"but theQuestion is:\"%@\"", theQuestion);
    }
Run Code Online (Sandbox Code Playgroud)

if-statement objective-c stringwithformat stringwithstring

4
推荐指数
1
解决办法
764
查看次数

XCode警告:使用'stringWithString':文字是多余的

我收到了以下警告

Using 'stringWithString': with a literal is redundant

在使用该方法时 usingWithString

[NSString stringWithString:@"Content-Type: content/unknown\r\n\r\n"]
Run Code Online (Sandbox Code Playgroud)

xcode warnings nsstring ios stringwithstring

4
推荐指数
1
解决办法
4938
查看次数