# Adds the App.framework as an embedded binary and the flutter_assets as # resources. EmbedFlutterFrameworks() { # Embed App.framework from Flutter into the app (after creating the Frameworks directory #if it doesn't already exist). local xcode_frameworks_dir="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" RunCommand mkdir -p -- "${xcode_frameworks_dir}" RunCommand rsync -av --delete --filter "- .DS_Store/" "${BUILT_PRODUCTS_DIR}/App.framework" "${xcode_frameworks_dir}"
# Embed the actual Flutter.framework that the Flutter app expects to run against, #which could be a local build or an arch/type specific build.
# Copy Xcode behavior and don't copy over headers or modules. RunCommand rsync -av --delete --filter "- .DS_Store/" --filter "- Headers/" --filter "- Modules/" "${BUILT_PRODUCTS_DIR}/Flutter.framework" "${xcode_frameworks_dir}/" if [[ "$ACTION" != "install" || "$ENABLE_BITCODE" == "NO" ]]; then # Strip bitcode from the destination unless archiving, or if bitcode is disabled entirely. RunCommand "${DT_TOOLCHAIN_DIR}"/usr/bin/bitcode_strip "${BUILT_PRODUCTS_DIR}/Flutter.framework/Flutter" -r -o "${xcode_frameworks_dir}/Flutter.framework/Flutter" fi
# Sign the binaries we moved. if [[ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" ]]; then RunCommand codesign --force --verbose --sign "${EXPANDED_CODE_SIGN_IDENTITY}" -- "${xcode_frameworks_dir}/App.framework/App" RunCommand codesign --force --verbose --sign "${EXPANDED_CODE_SIGN_IDENTITY}" -- "${xcode_frameworks_dir}/Flutter.framework/Flutter" fi
/** * Initializes this FlutterViewController with the specified `FlutterEngine`. * * The initialized viewcontroller will attach itself to the engine as part of this process. * * @param engine The `FlutterEngine` instance to attach to. * @param nibNameOrNil The NIB name to initialize this UIViewController with. * @param nibBundleOrNil The NIB bundle. */ - (instancetype)initWithEngine:(FlutterEngine*)engine nibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
/** * Initializes a new FlutterViewController and `FlutterEngine` with the specified * `FlutterDartProject`. * * @param projectOrNil The `FlutterDartProject` to initialize the `FlutterEngine` with. * @param nibNameOrNil The NIB name to initialize this UIViewController with. * @param nibBundleOrNil The NIB bundle. */ - (instancetype)initWithProject:(FlutterDartProject*)projectOrNil nibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithEngine:(FlutterEngine*)engine nibName:(nullableNSString*)nibName bundle:(nullableNSBundle*)nibBundle { NSAssert(engine != nil, @"Engine is required"); self = [super initWithNibName:nibName bundle:nibBundle]; if (self) { _viewOpaque = YES; if (engine.viewController) { FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String] << " is already used with FlutterViewController instance " << [[engine.viewController description] UTF8String] << ". One instance of the FlutterEngine can only be attached to one " "FlutterViewController at a time. Set FlutterEngine.viewController " "to nil before attaching it to another FlutterViewController."; } // 此处省略 ... } returnself; }