Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

ios - what is the delegate of these NSURLSession methods in Swift?

XCode is not auto completing this methods i did set the delegate for

NSURLSessionTaskDelegate,NSURLSessionDelegate,NSURLSessionDownloadDelegate

but it still not completing so i feel that i am setting the wrong delegates cause thats what xcode do when i set the wrong delegate

URLSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)
URLSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)
URLSession(_:downloadTask:didFinishDownloadingToURL:)

well whats wrong with swift this time

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you type this into Playground:

class Downloader : NSObject, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate {

}

and then start typing inside the class URLS you get all the autocompletion stuff. Try that and if this does not work restart Xcode. Maybe "cleaning" the project will also help.

Please also note that the methods you reference in your question are defined by the NSURLSessionDownloadDelegate, which you did not include.

Sometimes you have to use the up or down arrow key to scroll to the right autocompletion entry.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...