skip to Main Content

I have an android app written with Flutter.
Now I am trying to ios version of it and I am getting errors. I tried to run empty flutter project, and it works successfully.

No errors with pod install

After I tried flutter run I am getting these errors.
My pod file on below.

How can I solve this problem?

Flutter run output:

    Xcode's output:
↳
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.m:395:23:
    warning: 'requiresUserActionForMediaPlayback' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
            configuration.requiresUserActionForMediaPlayback = true;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          mediaTypesRequiringUserActionForPlayback
    In module 'WebKit' imported from
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.h:6:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Framew
    orks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28: note: 'requiresUserActionForMediaPlayback' has been explicitly marked
    deprecated here
    @property (nonatomic) BOOL requiresUserActionForMediaPlayback API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback",
    ios(9.0, 10.0));
                               ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.m:407:23:
    warning: 'requiresUserActionForMediaPlayback' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
            configuration.requiresUserActionForMediaPlayback = false;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          mediaTypesRequiringUserActionForPlayback
    In module 'WebKit' imported from
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.h:6:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Framew
    orks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28: note: 'requiresUserActionForMediaPlayback' has been explicitly marked
    deprecated here
    @property (nonatomic) BOOL requiresUserActionForMediaPlayback API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback",
    ios(9.0, 10.0));
                               ^
    2 warnings generated.
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/InAppBrowser/InAppBrow
    serWebViewController.swift:557:13: warning: setter for 'statusBarStyle' was deprecated in iOS 9.0: Use -[UIViewController
    preferredStatusBarStyle]
                UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue: previousStatusBarStyle)!
                ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariBrowserOptions.swift:34:16: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
                if #available(iOS 10.0, *) {
                   ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariBrowserOptions.swift:12:14: note: enclosing scope here
    public class SafariBrowserOptions: Options<SafariViewController> {
                 ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariViewController.swift:66:12: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
            if #available(iOS 10.0, *) {
               ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariViewController.swift:12:14: note: enclosing scope here
    public class SafariViewController: SFSafariViewController, FlutterPlugin, SFSafariViewControllerDelegate {
                 ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariBrowserOptions.swift:34:16: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
                if #available(iOS 10.0, *) {
                   ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariBrowserOptions.swift:12:14: note: enclosing scope here
    public class SafariBrowserOptions: Options<SafariViewController> {
                 ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariViewController.swift:66:12: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
            if #available(iOS 10.0, *) {
               ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
    afariViewController.swift:12:14: note: enclosing scope here
    public class SafariViewController: SFSafariViewController, FlutterPlugin, SFSafariViewControllerDelegate {
                 ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Types/URLCredential.sw
    ift:14:25: warning: comparing non-optional value of type '[Any]' to 'nil' always returns true
            if certificates != nil {
               ~~~~~~~~~~~~ ^  ~~~
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:86:25:
    warning: 'spotlightSuggestion' was deprecated in iOS 10.0: renamed to 'WKDataDetectorTypes.lookupSuggestion'
                    return .spotlightSuggestion
                            ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:86:25:
    note: use 'WKDataDetectorTypes.lookupSuggestion' instead
                    return .spotlightSuggestion
                            ^~~~~~~~~~~~~~~~~~~
                            WKDataDetectorTypes.lookupSuggestion
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:121:31:
    warning: 'spotlightSuggestion' was deprecated in iOS 10.0: renamed to 'WKDataDetectorTypes.lookupSuggestion'
                if type.contains(.spotlightSuggestion) {
                                  ^
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:121:31:
    note: use 'WKDataDetectorTypes.lookupSuggestion' instead
                if type.contains(.spotlightSuggestion) {
                                  ^~~~~~~~~~~~~~~~~~~
                                  WKDataDetectorTypes.lookupSuggestion
    /usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:216:21:
    warning: immutable value 'j' was never used; consider replacing with '_' or removing it
                    for j in ipv6.count...8 {
                        ^
                        _
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
          objc-class-ref in FIRCLSApplication.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Undefined symbols for architecture i386:
      "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
          objc-class-ref in FIRCLSApplication.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
          objc-class-ref in FIRCLSApplication.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    warning: Stale file
    '/Users/emre/Desktop/freegamescodes/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/flutter_local_notifications.framework' is
    located outside of the allowed root paths.


Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

My Pod file:

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

pod 'Firebase'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Google-Mobile-Ads-SDK'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
     end
  end

5

Answers


  1. Backup your project and try this command : flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace && flutter run

    Login or Signup to reply.
  2. Open lib/ios folder and delete

    • Podfile
    • Podfile.lock
    • Pods folder
    • Runner.xcworkspace

    then run flutter build ios

    After building ios, run open ios/Runner.xcworkspace/ and then run project in XCode for the first time, after that, everything would work fine.

    Login or Signup to reply.
  3. take a backup of project then delete ios folder and use command "flutter create ."
    don’t forget dot.

    Login or Signup to reply.
  4. flutter clean
    then go to
    cd ios

    then restart the IDE ..

    Login or Signup to reply.
  5. Open pubspec.yaml,

    • click on pub_upgrade or type flutter pub upgrade
    • flutter clean ,

    Open the lib/ios folder and delete the

    Podfile.lock

    and run

    pod install

    , after building the ios file, run the project of Xcode and everything will be fine.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search