Skip to content

里面含有null时崩溃 #866

Description

@kedu

bugly上上报的,如下
Trapped uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write ((null))' ( 0 CoreFoundation 0x00000001a1be00cc AE3C9338-0166-397A-9643-356B14F6EE58 + 1155276, 1 libobjc.A.dylib 0x000000019f079abc objc_exception_throw + 88, 2 Foundation 0x00000001a07db2c4 C031896B-2EF1-3D89-966A-0B52D54BCEEE + 639684, 3 Foundation 0x00000001a08373d4 C031896B-2EF1-3D89-966A-0B52D54BCEEE + 1016788, 4 CoreFoundation 0x00000001a1ae413c AE3C9338-0166-397A-9643-356B14F6EE58 + 123196, 5 CoreFoundation 0x00000001a1ae39d0 AE3C9338-0166-397A-9643-356B14F6EE58 + 121296, 6 Foundation 0x00000001a08371f0 C031896B-2EF1-3D89-966A-0B52D54BCEEE + 1016304, 7 Foundation 0x00000001a07f78e8 C031896B-2EF1-3D89-966A-0B52D54BCEEE + 755944, 8 Foundation 0x00000001a07a1200 C031896B-2EF1-3D89-966A-0B52D54BCEEE + 401920, 9 MJExtension 0x00000001095304d0 -[NSObject(MJKeyValue) mj_JSONData] + 164, 10 MJExtension 0x0000000109530664 -[NSObject(MJKeyValue) mj_JSONString] + 136。
我看AI给出的解决办法是加上判断[NSJSONSerialization isValidJSONObject:cleanObject]。我想问下为什么框架没有这个判断,基于什么理由?我加上这个是不是就可以解决这个问题

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions