隐私清单和 iOS URL 处理程序
复制一个包含安装步骤和本插件完整 Markdown 指南的配置提示。
应用开发者隐私清单
应用开发者隐私清单如果您使用Google、Facebook或Apple登录,需要在应用中声明这些SDK收集的数据。将文件添加到您的应用中。 PrivacyInfo.xcprivacy 在您的应用程序中添加该文件 ios/App/PrivacyInfo.xcprivacy.
不要将此文件添加到插件包中。根据您的应用程序使用情况和提供商SDK文档调整数据类型。
复制到剪贴板
Facebook Login示例{ "NSPrivacyCollectedDataTypes": [ { "NSPrivacyCollectedDataType": "EmailAddress", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "Name", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "UserID", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false } ]}Section titled “Privacy manifest for app developers”
Section titled “Google Sign-In example”{ "NSPrivacyCollectedDataTypes": [ { "NSPrivacyCollectedDataType": "EmailAddress", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "Name", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "UserID", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "FriendsList", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false } ]}Section titled “Facebook Login example”
Apple Sign-In 示例{ "NSPrivacyCollectedDataTypes": [ { "NSPrivacyCollectedDataType": "EmailAddress", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false }, { "NSPrivacyCollectedDataType": "Name", "NSPrivacyCollectedDataTypeLinked": true, "NSPrivacyCollectedDataTypeTracking": false } ]}查看 Apple隐私声明文档 所有允许的键和值。
结合Facebook和GoogleURL处理程序
标题:结合Facebook和GoogleURL处理程序当iOS应用程序使用Facebook和Google登录时,路由回调URL到两个SDK,然后将其传递回Capacitor。
在 ios/App/App/AppDelegate.swift:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { // Return true if the URL was handled by either Facebook or Google authentication. if FBSDKCoreKit.ApplicationDelegate.shared.application( app, open: url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplication.OpenURLOptionsKey.annotation] ) || GIDSignIn.sharedInstance.handle(url) { return true }
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)}确保 AppDelegate.swift 导入应用程序使用的SDK:
import Capacitorimport FBSDKCoreKitimport GoogleSignInimport UIKit