NSJSONSerialization not creating mutable containers

前端 未结 4 1676
孤街浪徒
孤街浪徒 2021-02-07 10:05

Here\'s the code:

NSError *parseError;
NSMutableArray *listOfObjects = [NSJSONSerialization JSONObjectWithData:[@\"[]\" dataUsingEncoding:NSUTF8StringEncodin         


        
4条回答
  •  旧巷少年郎
    2021-02-07 10:41

    Here is what I do:

    BOOL needsWorkaround = YES;
    if (needsWorkaround)
    {
        NSMutableDictionary* appState2 = 
            (__bridge_transfer NSMutableDictionary*) 
            CFPropertyListCreateDeepCopy (
                kCFAllocatorDefault, (__bridge void*)appState,
                kCFPropertyListMutableContainersAndLeaves
            );
        appState = appState2;
    }
    

提交回复
热议问题