先从服务器获取七牛token,再从相册选取图片,然后转化为data格式传到七牛。上传过程序崩溃 出现 data parameter is nil 的错误
Terminating app due to uncaught exception
'NSInvalidArgumentException',
reason: 'data parameter is nil'
崩溃的地点是
七牛文件中的#import "QNUrlSafeBase64.h"
NSData *data = [QNUrlSafeBase64 decodeString:array[2]];
NSError *tmp = nil;
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&tmp];
if (tmp != nil || dict[@"scope"] == nil || dict[@"deadline"] == nil) {
return nil;
}
阿神2017-05-02 09:27:37
Be sure to determine whether the data is empty. When the data is empty, an exception will be thrown.