Objective-c - Uploading pictures on the mobile phone returns data parameter is nil
PHPz
PHPz 2017-05-02 09:25:37
0
1
566

First get the Qiniu token from the server, then select the picture from the album, and then convert it into data format and send it to Qiniu. The upload program crashed with data parameter is nil error

Terminating app due to uncaught exception
'NSInvalidArgumentException',
reason: 'data parameter is nil'

The crash location is
#import "QNUrlSafeBase64.h" in the Qiniu file

 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;
}
PHPz
PHPz

学习是最好的投资!

reply all(1)
阿神

Be sure to determine whether the data is empty. When the data is empty, an exception will be thrown.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template