开发者

'NSString undeclared'

This is extremely silly, but I can't figure out how to use an NSString in my iPhone app musings.

I haven开发者_如何学JAVA't imported anything special (just stdio.h). When I tried declaring:

NSString *test = @"Hello World"

and compiled, I get the error: 'NSString undeclared'

How do I fix this? Also, when I try adding

#import <Foundation/Foundation.h>

I get 3951 build errors.


I haven't imported anything special (just stdio.h).

You should #import <Foundation/Foundation.h>

You Application should be of type Foundation

'NSString undeclared'


You need to import Foundation.h. You probably don't need or want stdio.h.


Use

NSString *test=[NSString stringWithFormat:@"Hello World"];

Cheers


This is also silly. Did you put a semicolon after the line?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜