5
Swift 2.3에서 Swift 3으로 프로젝트를 이전하려고합니다. 예상했던대로 어려움이 있습니다.Swift 3에 대한 모호한 참조
다음은 OAuthSwift을 사용하여 OAuth에 사용되는 함수입니다. 나는
class func OAuthSwiftAuthorization(inViewController viewController: UIViewController, withOAuthInfo info:FitnessTracker, successHandler:@escaping MyOAuthNewSuccessHandler, failure: @escaping ((_ error: NSError) -> Void)) {
let oauthswift = OAuth2Swift(
consumerKey: info.consumerKey,
consumerSecret: info.consumerSecret,
authorizeUrl: info.authorizeUrl,
accessTokenUrl: info.accessTokenUrl,
responseType: info.responseType
)
oauthswift.authorizeURLHandler = SafariURLHandler(viewController: viewController, oauthSwift: oauthswift)
oauthswift.accessTokenBasicAuthentification = true
oauthswift.allowMissingStateCheck = true
oauthswift.authorize(withCallbackURL: URL(string: info.callBackUrl)!, scope: info.scope, state: info.state, success: { (credential, response, parameters) in
successHandler(credential, response, parameters)
}) { (error) in
failure(error: error)
print(error.localizedDescription)
}
}
변환하려고 노력하지만
oauthswift.authorize(withCallbackURL: URL(string: info.callBackUrl)!, scope: info.scope, state: info.state, success: { (credential, response, parameters) in
오류 상태
withCallbackURL (인증 '회원에게모호한 기준에 오류가 점점 오전 : 범위 : 상태 : 매개 변수 : 헤더 : 성공 : 실패 :) '
다음은 Swi의 작업 코드입니다. 피트 2.
oauthswift.authorizeWithCallbackURL(
URL(string: info.callBackUrl)!,
scope: info.scope, state:info.state,
success: { credential, response, parameters in
successHandler(credientials: credential, response: response, params: parameters)
},
failure: { error in
failure(error: error)
print(error.localizedDescription)
}
)
업데이트 : 성공과 faliure handelrs을 입력 unitil
오류가 표시되지 않습니다. 다음 사항을 준수합니다.
oauthswift.authorize(withCallbackURL: URL(string: info.callBackUrl)!, scope: info.scope, state: info.state, success: { (credential, response, parameters) in
// successHandler(credential, response, parameters)
}) { (erorr) in
// failure(error: error
}
그래서 감사합니다.
트릭을 사용하지 않으면 트릭을 수행 할 수 없습니다. 그러나 나는 이유를 이해하지 못한다!! –
이것은 단점입니다. 여기를 참조하십시오 : https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160704/002370.html –