self.uploadContentSequence = [Future<Future<VoID,NoError>,NoError>]();for post in posts { self.uploadContentSequence.append(future(self.preparePostUpload(post)))}self.uploadContentSequence.sequence().onComplete { (_) -> VoID in print("onComplete")}.onSuccess { (_) -> VoID in print("onSuccess")}.onFailure { (_) -> VoID in print("onFailure")}[...]func preparePostUpload(post: Post) -> Future<VoID,NoError> { let promise = Promise<VoID,NoError>() [...] let postLocation = CLLocation(latitude: Double(post.lat!),longitude: Double(post.lng!)) let geocoder = CLGeocoder(); let countryCode = NSLocale.currentLocale().objectForKey(NSLocaleCountryCode) as! String post.country = countryCode geocoder.reverseGeocodeLocation(postLocation,completionHandler: { (placemarks,locError) -> VoID in [...] promise.success() }); return promise.future}解决方法 正如phimage在本期杂志中所指出的那样: https://github.com/Thomvis/BrightFutures/issues/111我将在未来完成未来. 总结
以上是内存溢出为你收集整理的swift – Promise.onSuccess立即调用全部内容,希望文章能够帮你解决swift – Promise.onSuccess立即调用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)