Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以支持NSDictionary,有考虑吗? #16

Open
Gantios opened this issue Jul 8, 2015 · 5 comments
Open

可以支持NSDictionary,有考虑吗? #16

Gantios opened this issue Jul 8, 2015 · 5 comments

Comments

@Gantios
Copy link

Gantios commented Jul 8, 2015

No description provided.

@EnjoySR
Copy link
Owner

EnjoySR commented Jul 8, 2015

就是直接把NSDictionary的字符串形式放入进去格式化是吧?

@yangchao0033
Copy link

可以试试在底层把字典转成json,我有用过类似的方法

  • (NSString*)dictionaryToJson:(NSDictionary *)dic
    {
    NSError *parseError = nil;

    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];

    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    }

@EnjoySR
Copy link
Owner

EnjoySR commented Aug 5, 2015

@yangchao0033 他是指的NSDictionary的description的打印

@Gantios
Copy link
Author

Gantios commented Aug 17, 2015

嗯~ 是的~ 因为我这边自己写的网络请求,和服务端约定好了,所以-(void)dataRequestConnectionDidFinishLoading:(NSURLConnection *)connection,就直接 [NSJSONSerialization JSONObjectWithData:self.allData options:NSJSONReadingMutableLeaves error:&error]; 转成 NSDictionary 。

@wustzhy
Copy link

wustzhy commented Jul 10, 2016

{"name":"zhangsan"} 可以成功
但是{@"name":@"zhangsan"}不能行
还有{name:"张三"}不能行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants