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

fix the bug, change 'List<object>' to JsonArray #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rayosu
Copy link

@rayosu rayosu commented Mar 17, 2015

if you use protobuf and you will use this way to get the array data
var jWeapons = json["weapons"] as List;

this commit fix the bug, when you used protobuf still can use:
var jWeapons = json["weapons"] as JsonArray;
that the right way to get array in json.

if use List<object>, you will use this way to get the data
var jWeapons = json["weapons"] as List<object>;

but now you cant use:
var jWeapons = json["weapons"] as JsonArray;
that the right way to get array in json.
@zk-luke
Copy link
Member

zk-luke commented Mar 25, 2015

为啥要这么改?是因为unity4.6.3 在ios上用IL2CPP方式simple-json解析数组或者List会出错么?

@rayosu
Copy link
Author

rayosu commented Mar 25, 2015

不是, 只是这是一个bug.
你没启动protobuf的时候, 网络json解析你使用了JsonArray类型来存json中的数组.
而你protobuf中的转换代码却使用了List. 这导致前后的json操作API不一致. 所有代码都受影响.

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

Successfully merging this pull request may close these issues.

2 participants