facebook登录
This commit is contained in:
parent
9a26c4ac7f
commit
9a50ca2fdc
@ -7,6 +7,8 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
1B384A992DC1CFE800F5B1A2 /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = 1B384A982DC1CFE800F5B1A2 /* FacebookCore */; };
|
||||||
|
1B384A9B2DC1CFE800F5B1A2 /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = 1B384A9A2DC1CFE800F5B1A2 /* FacebookLogin */; };
|
||||||
91D08C5AEAE459A3B8EA48C6 /* Pods_MoviaBox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A81436A54285C9EE97EEBC50 /* Pods_MoviaBox.framework */; };
|
91D08C5AEAE459A3B8EA48C6 /* Pods_MoviaBox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A81436A54285C9EE97EEBC50 /* Pods_MoviaBox.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -46,6 +48,8 @@
|
|||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
91D08C5AEAE459A3B8EA48C6 /* Pods_MoviaBox.framework in Frameworks */,
|
91D08C5AEAE459A3B8EA48C6 /* Pods_MoviaBox.framework in Frameworks */,
|
||||||
|
1B384A992DC1CFE800F5B1A2 /* FacebookCore in Frameworks */,
|
||||||
|
1B384A9B2DC1CFE800F5B1A2 /* FacebookLogin in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -139,6 +143,7 @@
|
|||||||
mainGroup = 1DBC40502DA4EDFC0093FCB0;
|
mainGroup = 1DBC40502DA4EDFC0093FCB0;
|
||||||
minimizedProjectReferenceProxies = 1;
|
minimizedProjectReferenceProxies = 1;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
|
1B384A972DC1CFE800F5B1A2 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */,
|
||||||
);
|
);
|
||||||
preferredProjectObjectVersion = 77;
|
preferredProjectObjectVersion = 77;
|
||||||
productRefGroup = 1DBC405A2DA4EDFC0093FCB0 /* Products */;
|
productRefGroup = 1DBC405A2DA4EDFC0093FCB0 /* Products */;
|
||||||
@ -446,6 +451,30 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
1B384A972DC1CFE800F5B1A2 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/facebook/facebook-ios-sdk";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 14.1.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
1B384A982DC1CFE800F5B1A2 /* FacebookCore */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 1B384A972DC1CFE800F5B1A2 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */;
|
||||||
|
productName = FacebookCore;
|
||||||
|
};
|
||||||
|
1B384A9A2DC1CFE800F5B1A2 /* FacebookLogin */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 1B384A972DC1CFE800F5B1A2 /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */;
|
||||||
|
productName = FacebookLogin;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = 1DBC40512DA4EDFC0093FCB0 /* Project object */;
|
rootObject = 1DBC40512DA4EDFC0093FCB0 /* Project object */;
|
||||||
}
|
}
|
||||||
|
15
MoviaBox.xcworkspace/xcshareddata/swiftpm/Package.resolved
Normal file
15
MoviaBox.xcworkspace/xcshareddata/swiftpm/Package.resolved
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"originHash" : "ca3cf5f8f83d297b47d2cb0edff3e06f294951e2e06fa55cfc82831103499b2a",
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "facebook-ios-sdk",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/facebook/facebook-ios-sdk",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "c19607d535864533523d1f437c84035e5fb101cf",
|
||||||
|
"version" : "14.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 3
|
||||||
|
}
|
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import FacebookCore
|
||||||
|
|
||||||
|
|
||||||
extension AppDelegate {
|
extension AppDelegate {
|
||||||
@ -45,6 +46,12 @@ extension SceneDelegate {
|
|||||||
|
|
||||||
///URL打开APP
|
///URL打开APP
|
||||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||||
|
guard let url = URLContexts.first?.url else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationDelegate.shared.application(UIApplication.shared, open: url, sourceApplication: nil, annotation: [UIApplication.OpenURLOptionsKey.annotation])
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import FacebookCore
|
||||||
|
|
||||||
@main
|
@main
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
@ -13,6 +14,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
|
|
||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
|
///Facebook
|
||||||
|
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
|
|
||||||
self.appConfig()
|
self.appConfig()
|
||||||
///注册消息通知
|
///注册消息通知
|
||||||
|
11
MoviaBox/Base/Define/SPAPPKey.swift
Normal file
11
MoviaBox/Base/Define/SPAPPKey.swift
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
//
|
||||||
|
// SPAPPKey.swift
|
||||||
|
// MoviaBox
|
||||||
|
//
|
||||||
|
// Created by 佳尔 on 2025/4/30.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
let kSPAppleAppId = "6745007239"
|
||||||
|
let kSPAppleDownloadPath = "https://apps.apple.com/app/id6670203263"
|
@ -6,10 +6,55 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import FacebookLogin
|
||||||
|
|
||||||
//https://developers.facebook.com/docs/facebook-login/ios?checkpoint_src=any
|
//https://developers.facebook.com/docs/facebook-login/ios?checkpoint_src=any
|
||||||
extension SPLoginManager {
|
extension SPLoginManager {
|
||||||
|
|
||||||
|
///facebook登录
|
||||||
|
func facebookSignLogin(presentingViewController: UIViewController, completer: ((_ model: SPThirdSignModel?) -> Void)?) {
|
||||||
|
|
||||||
|
let loginManager = LoginManager()
|
||||||
|
loginManager.logOut()
|
||||||
|
loginManager.defaultAudience = .everyone
|
||||||
|
|
||||||
|
loginManager.logIn(permissions: ["public_profile", "email"], from: presentingViewController) { result, error in
|
||||||
|
guard error == nil, let result = result else {
|
||||||
|
completer?(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if result.isCancelled {
|
||||||
|
completer?(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let request = GraphRequest(graphPath: "me", parameters: ["fields" : "id,name,email,picture"], httpMethod: .get)
|
||||||
|
request.start { connection, result, error in
|
||||||
|
guard let result = result as? [String : Any] else {
|
||||||
|
completer?(nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let model = SPThirdSignModel()
|
||||||
|
model.platform = .faceBook
|
||||||
|
model.third_id = result["id"] as? String
|
||||||
|
model.email = result["email"] as? String
|
||||||
|
|
||||||
|
if let picture = result["picture"] as? [String : Any],
|
||||||
|
let data = picture["data"] as? [String : Any],
|
||||||
|
let url = data["url"] as? String
|
||||||
|
{
|
||||||
|
model.avator = url
|
||||||
|
}
|
||||||
|
|
||||||
|
if let name = result["name"] as? String {
|
||||||
|
model.family_name = name
|
||||||
|
} else {
|
||||||
|
model.family_name = result["first_name"] as? String
|
||||||
|
model.giving_name = result["last_name"] as? String
|
||||||
|
}
|
||||||
|
completer?(model)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,12 @@ class SPLoginManager: NSObject {
|
|||||||
appleSignLogin { [weak self] model in
|
appleSignLogin { [weak self] model in
|
||||||
self?.requestThirdLogin(thirdSignModel: model, completer: completer)
|
self?.requestThirdLogin(thirdSignModel: model, completer: completer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case .faceBook:
|
||||||
|
facebookSignLogin(presentingViewController: presentingViewController) { [weak self] model in
|
||||||
|
self?.requestThirdLogin(thirdSignModel: model, completer: completer)
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,7 @@
|
|||||||
<array>
|
<array>
|
||||||
<string>Default</string>
|
<string>Default</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>keychain-access-groups</key>
|
||||||
|
<array/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -2,8 +2,37 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Editor</string>
|
||||||
|
<key>CFBundleURLName</key>
|
||||||
|
<string>Facebook</string>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>fb1228062532660582</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
<dict/>
|
||||||
|
</array>
|
||||||
|
<key>FacebookAdvertiserIDCollectionEnabled</key>
|
||||||
|
<true/>
|
||||||
|
<key>FacebookAppID</key>
|
||||||
|
<string>1228062532660582</string>
|
||||||
|
<key>FacebookAutoLogAppEventsEnabled</key>
|
||||||
|
<true/>
|
||||||
|
<key>FacebookClientToken</key>
|
||||||
|
<string>ecc9787c931b242fa912481c41b39bb6</string>
|
||||||
|
<key>FacebookDisplayName</key>
|
||||||
|
<string>$(PRODUCT_NAME)</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>fbapi</string>
|
||||||
|
<string>fb-messenger-share-api</string>
|
||||||
|
</array>
|
||||||
<key>UIApplicationSceneManifest</key>
|
<key>UIApplicationSceneManifest</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>UIApplicationSupportsMultipleScenes</key>
|
<key>UIApplicationSupportsMultipleScenes</key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user