intl_phone_number_input icon indicating copy to clipboard operation
intl_phone_number_input copied to clipboard

Fails to build only on iOS Simulator

Open easazade opened this issue 2 years ago • 5 comments

Describe the bug app fails to build for iOS Simulator when this package is simply added as a dependency. it builds successfully on iOS devices. this is causing our CI integration tests to fail since they run on iOS simulator

Package version ^0.7.0+2

Flutter version 2.10.5

Error log

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...                                           2,347ms
Running Xcode build...                                                  
Xcode build done.                                           12.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/zg/g1nhxgfj04l20_dw92rp3lc80000gn/T/flutter_tools.LngiIG/flutter_ios_build_temp_dirsqsER5/temporary_xcresult_bundle

    rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at
    /System/Volumes/Data/SWE/macOS/BuildRoots/533514bb11/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/rsync.c(244) [sender=2.6.9]
    Command PhaseScriptExecution failed with a nonzero exit code
    ld: warning: ignoring file
    /Users/alireza/workspace/flutter/projects/city_project/city/apps/rekab/build/ios/Debug-iphonesimulator/libPhoneNumber-iOS/libPhoneNumber_iOS.framew
    ork/libPhoneNumber_iOS, missing required architecture arm64 in file
    /Users/alireza/workspace/flutter/projects/city_project/city/apps/rekab/build/ios/Debug-iphonesimulator/libPhoneNumber-iOS/libPhoneNumber_iOS.framew
    ork/libPhoneNumber_iOS (2 slices)
    ld: warning: ignoring file
    /Users/alireza/workspace/flutter/projects/city_project/city/apps/rekab/build/ios/Debug-iphonesimulator/libphonenumber/libphonenumber.framework/libp
    honenumber, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_NBAsYouTypeFormatter", referenced from:
          objc-class-ref in SwiftLibphonenumberPlugin.o
      "_OBJC_CLASS_$_NBPhoneNumberUtil", referenced from:
          objc-class-ref in SwiftLibphonenumberPlugin.o
      "_OBJC_CLASS_$_LibphonenumberPlugin", referenced from:
          objc-class-ref in SwiftLibphonenumberPlugin.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: Planning
    note: Build preparation complete
    note: Building targets in parallel
    /Users/alireza/workspace/flutter/projects/city_project/city/apps/rekab/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target
    'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target
    'libPhoneNumber-iOS' from project 'Pods')
    /Users/alireza/workspace/flutter/projects/city_project/city/apps/rekab/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target
    'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'FMDB' from project
    'Pods')

    Result bundle written to path:
        /var/folders/zg/g1nhxgfj04l20_dw92rp3lc80000gn/T/flutter_tools.LngiIG/flutter_ios_build_temp_dirsqsER5/temporary_xcresult_bundle


Error (Xcode): Undefined symbol: _OBJC_CLASS_$_NBAsYouTypeFormatter


Error (Xcode): Undefined symbol: _OBJC_CLASS_$_NBPhoneNumberUtil


Error (Xcode): Undefined symbol: _OBJC_CLASS_$_LibphonenumberPlugin


Could not build the application for the simulator.
Error launching application on iPhone 13.


Here is Podfile

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

# 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)
  end
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

easazade avatar Jun 20 '22 07:06 easazade

Did you find a solution to this @easazade ?

RohithKilaparthi avatar Nov 01 '22 05:11 RohithKilaparthi

Having same issue.

intl_phone_number_input: ^0.7.1

Flutter Doctor:

[✓] Flutter (Channel stable, 3.3.0, on macOS 12.6 21G115 darwin-arm, locale en-US)
    • Flutter version 3.3.0 on channel stable at /Users/Shared/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffccd96b62 (2 months ago), 2022-08-29 17:28:57 -0700
    • Engine revision 5e9e0e0aa8
    • Dart version 2.18.0
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/max/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.72.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] Connected device (3 available)
    • iPad (9th generation) (mobile) • 2FD35381-F359-49CF-8FD2-208180D8ECAA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator)
    • macOS (desktop)                • macos                                • darwin-arm64   • macOS 12.6 21G115 darwin-arm
    • Chrome (web)                   • chrome                               • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

mterenzi avatar Nov 09 '22 18:11 mterenzi

Anyone figure anything out about this?

mterenzi avatar Dec 13 '22 18:12 mterenzi

If you are using a macbook arch based architecture (M1 or M2) just reinstall pod package.

# Uninstall the local cocoapods gem
sudo gem uninstall cocoapods

# Reinstall cocoapods via Homebrew
brew install cocoapods

OmarKRostom avatar Mar 19 '23 11:03 OmarKRostom

@RohithKilaparthi Sorry for the late response. I checked the project and see that I have used this plugin instead. I don't remember Whether I fixed this issue on the project.

easazade avatar Mar 19 '23 12:03 easazade