开发者

initlializer element is not constant

guys i m getting this basic error "initializer element is not constant"..not able to figure where exactly i failed .below is the code.`

@implementation myfirstflickrappViewController

NSString *const FlickrAPIKey = @"14c39d71001b0fb84d1dacb6049580ec";

NSString *const text = @"hello";

NSString *urlString = 
[NSString stringWithFormat:
 @"http://api.f开发者_如何转开发lickr.com/services/rest/?method=flickr.photos.search&api_key=%@&tags=%@&per_page=25&format=json&nojsoncallback=1", 
 FlickrAPIKey, text];


You call a method on NSString (stringWithFormat:) in a place where you are not allowed to do so - namely outside of a method or function. Only constant expressions like string literals are allowed there.

You might put that code in your -init method or the class initializer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜