# iOS

教學

{% embed url="https://github.com/react-native-google-signin/google-signin/blob/master/docs/ios-guide.md" %}

1.加上 firebase 程式，然後跟著步驟

![](https://2356031413-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0u4DAqfidGmTt67qrG%2F-MLg4ShXGHAUdQWgef2j%2F-MLgTj4HJT7GX1yrViyE%2F%E6%88%AA%E5%9C%96%202020-11-09%20%E4%B8%8B%E5%8D%885.49.50.png?alt=media\&token=8d23dd7f-1426-4870-8bd7-7bac475f79bb)

2\.  podFile 加上

```
pod 'Firebase/Analytics'
pod 'GoogleSignIn', '~> 5.0.2'
```

然後pod install

3.修改 xcode

![](https://2356031413-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0u4DAqfidGmTt67qrG%2F-MLg4ShXGHAUdQWgef2j%2F-MLgTMyJXM2V_96SPrmn%2F%E6%88%AA%E5%9C%96%202020-11-09%20%E4%B8%8B%E5%8D%886.06.33.png?alt=media\&token=d52a1f87-999b-448c-94bb-bf77dc0ed8d2)

![](https://2356031413-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0u4DAqfidGmTt67qrG%2F-MLg4ShXGHAUdQWgef2j%2F-MLgTPERxucU_q5-2hpB%2F%E6%88%AA%E5%9C%96%202020-11-09%20%E4%B8%8B%E5%8D%886.06.38.png?alt=media\&token=1612fe3a-74a1-4abb-8960-abd116478a33)

4.修改 AppDelegate.m

```
// AppDelegate.m
- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options {
  return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options] || [RNGoogleSignin application:application openURL:url options:options];
}
```

### 範例：

```javascript
GoogleSignin.configure({
  iosClientId:
    '1795445603utvtntu93ui.apps.googleusercontent.com',
});

// iosClientId 把 GoogleService-Info 這段貼上
// <key>CLIENT_ID</key>
// <string>.....</string>
```
