2014-11-02 27 views
0

有谁知道如何迅速使用SBJson库?SBJson快捷

我有这个代码在Objective-C

NSString *responseString = [request responseString]; 
NSDictionary *responseDict = [responseString JSONValue]; 

var responseString = request.responseString 
let responseDict: NSDictionary = responseString.JSONValue 

Xcode的抱怨尝试 “() - > String不具有名为JSONValue成员”

我已包含

#import "SBJson.h" 

在“MyProjectName” -Bridging-Header.h

回答

0

刚刚发现:在扩展应用SBJson上的NSString类型,但斯威夫特字符串类型是不同的。

它的工作原理与此代码:

var responseString: NSString = request.responseString() 
let responseDict: NSDictionary = responseString.JSONValue() as NSDictionary