在Objective-C中,%@和%ld是什么意思?

Var*_*tla -1 string cocoa cocoa-touch objective-c nsstring

NSString *expectedURL = [NSString stringWithFormat:@"https://%@:%ld/%@"];

什么做%@%ld什么意思呢?

Avi*_*are 7

%@格式说明符,用于打印和格式化Objective-c对象。

%ld用于无符号64位整数.ie NSInteger。


Ewa*_*lor 5

它们是格式说明符。基本上,其余参数的插入点为stringWithFormat

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html