Iphone ';SBJSON';未声明(首次在此函数中使用)
当我尝试运行下面的代码时,我得到了未声明的“SBJSON”(首次在这个函数中使用)错误Iphone ';SBJSON';未声明(首次在此函数中使用),iphone,json,ios4,Iphone,Json,Ios4,当我尝试运行下面的代码时,我得到了未声明的“SBJSON”(首次在这个函数中使用)错误 #import "RootViewController.h" #import <JSON/JSON.h> @implementation RootViewController #pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; NSStrin
#import "RootViewController.h"
#import <JSON/JSON.h>
@implementation RootViewController
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
NSString *myRawJson=[[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://myserver/jsondata.php"]];
if([myRawJson length]==0)
{
[myRawJson release];
return;
}
SBJSON *parser=[[SBJSON alloc]init];
list = [[parser objectWithString:myRawJson error:nil]copy];
[parser release];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
#导入“RootViewController.h”
#进口
@RootViewController的实现
#布拉格标记-
#pragma标记视图生命周期
-(无效)viewDidLoad{
[超级视图下载];
NSString*myRawJson=[[NSString alloc]initWithContentsOfURL:[NSURL URLWithString:@]http://myserver/jsondata.php"]];
如果([myRawJson长度]==0)
{
[myRawJson发布];
回来
}
SBJSON*解析器=[[SBJSON alloc]init];
list=[[parser objectWithString:myRawJson错误:nil]copy];
[解析器发布];
//取消对以下行的注释,以在此视图控制器的导航栏中显示编辑按钮。
//self.navigationItem.rightBarButtonItem=self.editButtonItem;
}
有人能帮忙吗。我使用的是SDK 4.2。这一行:
#import <JSON/JSON.h>
#导入
您正在尝试导入,但尚未安装。这是一行:
#import <JSON/JSON.h>
#导入
您正在尝试导入,但尚未安装。我使用了SBJsonParser而不是SBJSON,现在可以正常工作了。也许这与我现在使用的iOS版本有关。我使用了SBJsonParser而不是SBJSON,现在可以正常工作了。可能与我使用的iOS版本有关。我确实安装了它。我还使用NSLog(@“解析了一些JSON:%@”,“[@”[1,2,3,true,false,null]“JSONValue”)对其进行了测试;一切似乎都很好。另外,当我输入SBJSON时,编辑器确实为我提供了单词的自动完成功能。我确实安装了它。我还使用NSLog(@“解析了一些JSON:%@”,“[@”[1,2,3,true,false,null]“JSONValue”)对其进行了测试;一切似乎都很好。另外,当我键入SBJSON时,编辑器会为这个词提供自动完成功能。。