【Flutter】Swift Compiler Error (Xcode): Cannot find 'GeneratedPluginRegistrant' in scopeを解決する


`flutter build ios`で謎のエラーが出るようになってしまった・・・

```
$ flutter build ios          


（中略）

Failed to build iOS app
Error output from Xcode build:
↳
    2022-06-28 17:54:50.481 xcodebuild[72631:2386405] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
    com.apple.dt.IDEWatchSupportCore
    2022-06-28 17:54:50.481 xcodebuild[72631:2386405] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
    Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/jp/36fbdpc50c10dxrdtz8rfbmm0000gn/T/flutter_tools.3cgI0T/flutter_ios_build_temp_dirNBCp9k/temporary_xcresult_bundle

    /Users/atomu/Desktop/GitHub/project/ios/Runner/AppDelegate.swift:17:5: error: cannot find 'GeneratedPluginRegistrant' in scope
        GeneratedPluginRegistrant.register(with: self)
        ^~~~~~~~~~~~~~~~~~~~~~~~~
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
    Command CompileSwiftSources failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/atomu/Desktop/GitHub/project/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target
    'MTBBarcodeScanner' from project 'Pods')
    /Users/atomu/Desktop/GitHub/project/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target
    'CardIO' from project 'Pods')
    /Users/atomu/Desktop/GitHub/project/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target
    'DeployGateSDK-framework' from project 'Pods')

    Result bundle written to path:
    	/var/folders/jp/36fbdpc50c10dxrdtz8rfbmm0000gn/T/flutter_tools.3cgI0T/flutter_ios_build_temp_dirNBCp9k/temporary_xcresult_bundle


Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code


Swift Compiler Error (Xcode): Cannot find 'GeneratedPluginRegistrant' in scope
/Users/atomu/Desktop/GitHub/project/ios/Runner/AppDelegate.swift:16:4


Encountered error while building for device.

```

```swift:AppDelegate.swift
import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    // deploygate
    DeployGateSDK
      .sharedInstance()
      .launchApplication(withAuthor: "my-group", key: "01234567890123456789")

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

```

どうやら`GeneratedPluginRegistrant`が見つからないらしい。なにそれ。。。


# 環境
```
$ flutter --version

Flutter 3.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 676cefaaff (6 days ago) • 2022-06-22 11:34:49 -0700
Engine • revision ffe7b86a1e
Tools • Dart 2.17.5 • DevTools 2.12.2
```


# 対応案その１

どうせキャッシュとかのせいだろうといつものおまじないみたいなコマンドを投入

https://qiita.com/717natsuki/items/ddb4adf13aec95e5f2e9

```
$ flutter clean
$ rm -Rf ios/Pods
$ rm -Rf ios/.symlinks
$ rm -Rf ios/Flutter/Flutter.framework
$ rm -Rf ios/Flutter/Flutter.podspec
$ rm ios/Podfile
```

特に状況は変わりませんでした。。。


# 対応案その2

https://arcanum.hatenablog.com/entry/2022/01/03/091259

上記を参考に同じことを実践。
が、全然違うエラーが出てしまった。。。


# 結局
その後色々試行錯誤していたのですが、結局問題は`ios/Runner/Runner-Bridging-Header.h`にありました。
```:ios/Runner/Runner-Bridging-Header.h
// ↓↓ 勘違いでコメントアウトしてた。。。
// #import "GeneratedPluginRegistrant.h"
#import <DeployGateSDK/DeployGateSDK.h>
```

DeployGateを使う時の設定変更をしていた際に誤って`ios/Runner/Runner-Bridging-Header.h`の`#import "GeneratedPluginRegistrant.h"`をコメントアウトしてしまっていました。
import文コメントアウトしたんだからそりゃ見つけられないよね。。。

このコメントアウトを解除して動かしたところすんなり動きました。よかった。


# さいごに
ドキュメントを適当にコピペするのはやめましょう