当在Simulator中调用此基于目标C的方法时,没关系。但是在真正的iPhone设备中,Thread 1: signal SIGABRT
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
这是代码
+ (NSData *)aesDecrypt:(NSURL *)url :(NSString *)key {
NSData *data = [NSData dataWithContentsOfURL: url];
if (data == nil) {
NSLog(@"file not found");
return nil;
}
char keyPtr[kCCKeySizeAES128];
bzero(keyPtr, sizeof(keyPtr));
[key getCString:keyPtr maxLength:sizeof(keyPtr)];
size_t bufferSize = [data length] + kCCBlockSizeAES128;
size_t decryptedBytesSize = 0;
void *buffer = malloc(bufferSize);
CCCryptorStatus result = CCCrypt(kCCDecrypt, kCCAlgorithmAES128, …Run Code Online (Sandbox Code Playgroud) 我想使用 decodeable 解析 JSON,但我得到一个错误类型不匹配,例如:
Swift.DecodingError.Context(codingPath: [], debugDescription: "预期解码数组,但找到了字典。"
我的 JSON :
{
"code": 0,
"data": {
"_id": "string",
"title": "string",
"images": [
"string"
],
"shortDesc": "string",
"desc": "string",
"price": 0,
"discountPrice": 0,
"quantity": 0,
"category": {
"name": "string",
"val": "string"
},
"brand": {
"name": "string",
"val": "string"
},
"variants": [
{
"name": "string",
"value": "string",
"quantity": 0,
"variantCode": "string"
}
],
"stockCode": "string",
"updatedDate": "2018-06-05T14:04:51.226Z",
"status": true,
"isDeleted": true,
"isNew": true,
"freeCargo": true,
"createDate": "2018-06-05T14:04:51.226Z",
"note1": "string",
"note2": "string",
"note3": …Run Code Online (Sandbox Code Playgroud)