小编Van*_*ana的帖子

NSTemporaryDirectory 或 documentDirectory :哪一个最安全地存储数据?

我正在使用 Alamofire 从服务器下载数据。我想保存在最安全的目录(DocumentDirectory,NSTemporaryDirectory)中。有人可以帮助我吗?

文件目录

   let destination: DownloadRequest.DownloadFileDestination = { _, _ in
        let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
        let fileURL = documentsURL.appendingPathComponent(fileName)

        return (fileURL, [.removePreviousFile, .createIntermediateDirectories])
    }
Run Code Online (Sandbox Code Playgroud)

NS临时目录

    let fileURL = URL(fileURLWithPath:  
    NSTemporaryDirectory()).appendingPathComponent(fileName)
    let destination: DownloadRequest.DownloadFileDestination = { _, _ in
            return (fileURL, [.createIntermediateDirectories, 
.removePreviousFile])
        }
Run Code Online (Sandbox Code Playgroud)

nsfilemanager ios swift alamofire

2
推荐指数
1
解决办法
2268
查看次数

如何在AWS API Gateway iOS中处理响应

我为我的API 生成API Gateway SDKios.在SDK我有两个类型的文件之一,这使得请求,另一个是处理响应-

1)TESTGetAllDataClient

2)TESTEmpty

let serviceClient = TESTGetAllDataClient.defaultClient()
serviceClient.rootPost("2015").continueWithBlock{ (task:AWSTask!) -> (AnyObject!) in
        if task.error != nil {

            print(task.error)

        } else {

let resultDict :TESTEmpty = task.result as! TESTEmpty

        }
        return nil
    }
Run Code Online (Sandbox Code Playgroud)

TestEmpty是类型response.但是在我的TestEmpty课程中,我得到了API Gateway SDK,不包含任何提取字典表单对象的方法.TestEmpty implementation class在下面:

@implementation TESTEmpty

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{

            };
}

@end
Run Code Online (Sandbox Code Playgroud)

我是否需要编写自己的方法来处理响应,否则它将由SDK?提供?如果您对此有任何了解,请回复.我是新来的AWS API Gateway.

谢谢

api amazon-web-services ios swift aws-api-gateway

1
推荐指数
1
解决办法
1030
查看次数