-1
我第一次使用SFSafariViewController,幫助我知道如何在目標c中使用SFSafariVieController獲取重定向URL?如何在目標c中使用SFSafariVieController獲取重定向URL?
我第一次使用SFSafariViewController,幫助我知道如何在目標c中使用SFSafariVieController獲取重定向URL?如何在目標c中使用SFSafariVieController獲取重定向URL?
試試這個代碼,希望它會有助於您:
import UIKit
import SafariServices
class ViewController: UIViewController, SFSafariViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let myActivity = NSUserActivity(activityType: "com.google.searchAPIs.detail")
myActivity.title = "Cupertino" // 2
myActivity.eligibleForSearch = true // 4
myActivity.keywords = Set(arrayLiteral: "Cupertino", "Silcon Valley", "California", "San Jose", "San Francisco", "Apple Inc", "Mothership") // 5
self.userActivity = myActivity // 6
myActivity.eligibleForHandoff = false // 7
myActivity.becomeCurrent() // 8
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func didPressButton(sender: AnyObject) {
let safariVC = SFSafariViewController(URL:NSURL(string: "https://en.wikipedia.org/wiki/Cupertino,_California")!, entersReaderIfAvailable: true) // Set to false if not interested in using reader
safariVC.delegate = self
self.presentViewController(safariVC, animated: true, completion: nil)
}
func safariViewControllerDidFinish(controller: SFSafariViewController) {
controller.dismissViewControllerAnimated(true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
嗨王子,我使用fitbit登錄的API,我需要登錄後取得網址。 我在目標c中使用代碼。請幫助我客觀c –
請檢查此鏈接:https://auth0.com/authenticate/ios-swift/fitbit –
檢查此鏈接希望這可能會幫助你:https://omarmetwally.quora.com/Integrating-在-Fitbit-API功能於IOS的應用 –