【发布时间】:2021-07-18 19:46:02
【问题描述】:
我认为是时候开始使用 Swift 了,所以我正在对一个 obj C 应用程序进行完全重写。这个应用程序使用 Parse Server 和 CocoaPods。在我的 AppDelegate.swift 中的 ParseSwift 文档示例之后,我添加了
import ParseSwift
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
ParseSwift.initialize(applicationId: "AppID", clientKey: "", serverURL: URL(string: "https://server")!, liveQueryServerURL: URL(string: "https://server")!, authentication: ((URLAuthenticationChallenge,(URLSession.AuthChallengeDisposition,URLCredential?) -> Void) -> Void))
等等...但是初始化行显示错误
无法将类型 '((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void).Type' 的值转换为预期的参数类型 '((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, URLCredential?) - > 无效)-> 无效)?'
【问题讨论】:
-
你不能那样初始化它...
URLAuthenticationChallenge、URLSession.AuthChallengeDisposition和URLCredential?只是一个类型。您需要一个实际的实例化对象
标签: swift parse-platform