Convert nsdictionary to nsdata

后端 未结 5 2147
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 19:38

have an app that can take a picture and then upload to a server. encoding it to base 64 and pass it thru a XMLRPC to my php server.

i want to take the NSDictionary info

5条回答
  •  孤城傲影
    2021-02-05 20:26

    NSDictionary -> NSData:

        NSData *myData = [NSKeyedArchiver archivedDataWithRootObject:myDictionary];
    

    NSData -> NSDictionary:

        NSDictionary *myDictionary = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:myData];
    

提交回复
热议问题