This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
var error : NSError? | |
GGLContext.sharedInstance().configureWithError(&error) | |
if error != nil{ | |
print(error) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet weak var signInButton: GIDSignInButton! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import GoogleSignIn | |
class ViewController: UIViewController,GIDSignInUIDelegate,GIDSignInDelegate {......} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
GIDSignIn.sharedInstance().uiDelegate = self | |
GIDSignIn.sharedInstance().delegate = self | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { | |
if error != nil{ | |
print(error) | |
return | |
}else{ | |
print(user.userID) | |
print(user.profile.email) | |
print(user.profile.imageURL(withDimension: 400)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func signOut(_ sender: UIButton) { | |
GIDSignIn.sharedInstance().signOut() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<key>LSApplicationQueriesSchemes</key> | |
<array> | |
<string>fbapi</string> | |
<string>fb-messenger-api</string> | |
<string>fbauth2</string> | |
<string>fbshareextension</string> | |
</array> | |
<key>CFBundleURLTypes</key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) | |
return true | |
} | |
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { | |
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import FBSDKLoginKit | |
class ViewController: UIViewController,FBSDKLoginButtonDelegate {......} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
faceBookLogIn.readPermissions = ["public_profile", "email", "user_friends"] | |
faceBookLogIn.delegate = self | |
// 第一次登入後可取得使用者token,後續即可直接登入 | |
if (FBSDKAccessToken.current()) != nil{ | |
// fetchProfile() | |
} |
OlderNewer