How to convert dispatch_data_t to NSData?

后端 未结 2 1720
北荒
北荒 2021-01-12 07:32

Is this the right way?

// convert
const void *buffer = NULL;
size_t size = 0;
dispatch_data_t new_data_file = dispatch_data_create_map(data, &buffer, &am         


        
2条回答
  •  旧时难觅i
    2021-01-12 07:58

    Since iOS 7 and macOS 10.9 (Foundation Release Notes) dispatch_data_t is an NSObject (NSObject ) in 64 bit apps.

    dispatch_data_t can now be freely cast to NSData *, though not vice versa.

提交回复
热议问题