我一直试图弄清楚为什么这个简单的AWSS3配置设置可能会造成5000个内存泄漏.这是我在AppDelegate中运行的代码:
func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // SetUp AWS Config let myIdentityPoolId = Constants.AWS_IDENTITY_POOL_ID let credentialsProvider: AWSCognitoCredentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2,identityPoolId: myIdentityPoolId) if let configuration = AWSServiceConfiguration(region: .USWest2,credentialsProvider:credentialsProvider) { AWSS3.register(with: configuration,forKey: "defaultKey") } return AWSMobileClient.sharedInstance().interceptApplication(application,didFinishLaunchingWithOptions: launchOptions) }
使用Instruments,我已经测试了删除我共享的所有代码(返回AWSMobileClient.sharedInstance().interceptApplication除外)并发现我没有内存泄漏,但是一旦我将其添加回去,我就会遇到所有泄漏… 是什么赋予了?
如果它有帮助,我想列出我的AWS桶的对象,它使用以下代码:
let listRequest: AWSS3ListObjectsRequest = AWSS3ListObjectsRequest() let s3 = AWSS3.s3(forKey: "defaultKey") listRequest.bucket = Constants.AWS_BUCKET listRequest.prefix = Constants.SPECIAL_PREFIX s3.listObjects(listRequest).continueWith { (task) -> AnyObject? in }
我犯了明显的错误吗?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。