search

Home  >  Q&A  >  body text

objective-c - 手机端上传图片返回data parameter is nil

先从服务器获取七牛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;
}
PHPzPHPz2757 days ago530

reply all(1)I'll reply

  • 阿神

    阿神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.

    reply
    0
  • Cancelreply