darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
193 stars 127 forks source link

Swift Compiler Error (Xcode): No such module 'FBSDKLoginKit' when building ipa (ios) #258

Closed Omar-Salem closed 1 year ago

Omar-Salem commented 1 year ago

What version are you using?

4.3.4+2

What OS and version are you using to local deploy your application?

macOs Monterey (version 12.4)

What platforms are you seeing the problem on?

iOS

Describe the Bug

when running flutter build ipa, It throws Swift Compiler Error (Xcode): No such module 'FBSDKLoginKit'

I ran flutter clean && flutter pub cache repair && flutter pub get && cd ios && rm -f Podfile.lock && pod repo update && pod update && pod install , same result

Note, issue doesnt happen with version 3.5.7

Expected Behavior

No errors should be thrown

To Reproduce

Use version 4.3.4+2 Run flutter build ipa

Relevant log output

No response

flutter doctor -v

[✓] Flutter (Channel stable, 3.0.2, on macOS 12.4 21F79 darwin-x64, locale en-AU)
    • Flutter version 3.0.2 at /Users/omarsalem/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (13 days ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

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

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google
    Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64

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

! Doctor found issues in 3 categories.

Info.plist (iOS)

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>GADApplicationIdentifier</key>
        <string>00000000000000-redacted-00000000000</string>
        <key>FacebookAutoLogAppEventsEnabled</key>
        <string>TRUE</string>
        <key>FacebookAdvertiserIDCollectionEnabled</key>
        <string>TRUE</string>
        <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>https</string>
            <string>http</string>
        </array>
        <key>CFBundleDevelopmentRegion</key>
        <string>$(DEVELOPMENT_LANGUAGE)</string>
        <key>CFBundleDisplayName</key>
        <string>MyTestApp</string>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIdentifier</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundleName</key>
        <string>test_mobile</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleShortVersionString</key>
        <string>$(FLUTTER_BUILD_NAME)</string>
        <key>CFBundleSignature</key>
        <string>org.omarsalem.test</string>
        <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>fbapi</string>
            <string>fbapi20130214</string>
            <string>fbapi20130410</string>
            <string>fbapi20130702</string>
            <string>fbapi20131010</string>
            <string>fbapi20131219</string>
            <string>fbapi20140410</string>
            <string>fbapi20140116</string>
            <string>fbapi20150313</string>
            <string>fbapi20150629</string>
            <string>fbapi20160328</string>
            <string>fbauth</string>
            <string>fb-messenger-share-api</string>
            <string>fb-messenger-api</string>
            <string>fbauth2</string>
            <string>fbshareextension</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>00000000000000-redacted-00000000000</string>
                </array>
            </dict>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>00000000000000-redacted-00000000000</string>
                </array>
            </dict>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>00000000000000-redacted-00000000000</string>
                </array>
            </dict>
        </array>
        <key>CFBundleVersion</key>
        <string>$(FLUTTER_BUILD_NUMBER)</string>
        <key>FacebookAppID</key>
        <string>00000000000000-redacted-00000000000</string>
        <key>FacebookDisplayName</key>
        <string>Test</string>
        <key>FacebookClientToken</key>
        <string>00000000000000-redacted-00000000000</string>
        <key>LSRequiresIPhoneOS</key>
        <true />
        <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true />
        </dict>
        <key>NSCalendarsUsageDescription</key>
        <string>Need to access calendar</string>
        <key>NSCameraUsageDescription</key>
        <string>Need to access camera</string>
        <key>NSContactsUsageDescription</key>
        <string>Need to access contacts</string>
        <key>NSLocationAlwaysUsageDescription</key>
        <string>Need to access location</string>
        <key>NSLocationWhenInUseUsageDescription</key>
        <string>Need to access location</string>
        <key>NSPhotoLibraryUsageDescription</key>
        <string>Need to access photo library</string>
        <key>UIBackgroundModes</key>
        <array>
            <string>remote-notification</string>
            <string>fetch</string>
            <string>location</string>
        </array>
        <key>UILaunchStoryboardName</key>
        <string>LaunchScreen</string>
        <key>UIMainStoryboardFile</key>
        <string>Main</string>
        <key>UIStatusBarHidden</key>
        <true />
        <key>UISupportedInterfaceOrientations</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UISupportedInterfaceOrientations~ipad</key>
        <array>
            <string>UIInterfaceOrientationPortrait</string>
            <string>UIInterfaceOrientationPortraitUpsideDown</string>
            <string>UIInterfaceOrientationLandscapeLeft</string>
            <string>UIInterfaceOrientationLandscapeRight</string>
        </array>
        <key>UIViewControllerBasedStatusBarAppearance</key>
        <false />
    </dict>
</plist>

Podfile (iOS)

Uncomment this line to define a global platform for your project

platform :ios, '11.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) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' end end end

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 1 year ago

@Omar-Salem your platform and IPHONEOS_DEPLOYMENT_TARGET must be the same 12.0

also Have you tried to archive using xcode instead of use flutter build ipa?

Omar-Salem commented 1 year ago

@darwin-morocho Yup setting IPHONEOS_DEPLOYMENT_TARGET to 12.0 fixed it. and it was working on xcode before

himanshu-binarychai commented 3 months ago

i am getting this issue in my mac m1 chip laptop still finding all solutions from internet but did'nt work for me please help ???