아래 코드를 실행하려고하면 'SBJSON'이 선언되지 않은 오류 (이 함수에서 처음 사용) 오류가 발생합니다.'SBJSON'이 선언되지 않음 (이 함수에서 처음 사용)
#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;
}
아무도 도와 줄 수 있습니다. SDK 4.2 사용하고 있습니다.
나는 그것을 설치해야합니다. 또한 NSLog (@ "JSON : % @", [@ "[1,2,3, true, false, null]"JSONValue]를 파싱했습니다. 모든 것이 잘 작동하는 것 같습니다. 또한 SBJSON을 입력하면 편집기에서 단어 자동 완성 기능을 제공합니다. – developer