各位大侠,我用swift来上传图片到OSS上,采用pod导入库,一切都好,但是在调用OSSTask的contineWithBlock时,出错:
1. 系统提示已经改名为continue了,我改完后,跳转过去后发现,确实是名字改成这样了,但是查看OSSTask.m,却还是原来的样子,不知道这是什么原因?
/*!
Enqueues the given block to be run once this task is complete.
This method uses a default execution strategy. The block will be
run on the thread where the previous task completes, unless the
the stack depth is too deep, in which case it will be run on a
dispatch queue with default priority.
@param block The block to be run once this task is complete.
@param cancellationToken The cancellation token (optional).
@returns A task that will be completed after block has run.
If block returns a OSSTask, then the task returned from
this method will not be completed until that task is completed.
*/
open
func `continue`(
_ block:
@escaping AliyunOSSiOS.
OSSContinuationBlock, cancellationToken:
OSSCancellationToken?) ->
OSSTask<
AnyObject>
/*!
Enqueues the given block to be run once this task is complete.
@param executor A OSSExecutor responsible for determining how the
continuation block will be run.
@param block The block to be run once this task is complete.
@returns A task that will be completed after block has run.
If block returns a OSSTask, then the task returned from
this method will not be completed until that task is completed.
*/
open
func `continue`(with executor:
OSSExecutor, with block:
@escaping AliyunOSSiOS.
OSSContinuationBlock) ->
OSSTask<
AnyObject>
/*!
A block that can act as a continuation for a task.
*/
public
typealias OSSContinuationBlock = (
OSSTask<
ResultType>) ->
Any?
2. 一番调研后,我发现OSSTask实际上是来自于开源框架Bolts, 我参照bolts的swift调用方法,改成如下,但是报
Ambiguous reference to member 'continue',
let putTask = ossClient?.
putObject(put)
putTask.
continue {
(task :
OSSTask) ->
Any
in
if (!(task.error !=
nil)) {
finished(
true,
nil)
}
else {
finished(
false,task.error
as!
String?)
}
}
3. 本人对iOS和swift都是新手,哪位大侠帮忙看看原因是什么?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。