Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode archive error 'No such module flutter_downloader' when using AppDelegate.swift #269

Closed
JHBitencourt opened this issue Mar 23, 2020 · 21 comments

Comments

@JHBitencourt
Copy link

I can't archive the project with XCode if I use AppDelegate.swift as stated in the docs.
Both flutter run --release and flutter build ios work.

  • XCode: Version 11.3.1 (11C504)

  • AppDelegate.swift:

import UIKit
import Flutter
import flutter_downloader

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    FlutterDownloaderPlugin.setPluginRegistrantCallback(registerPlugins)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

private func registerPlugins(registry: FlutterPluginRegistry) {
    if (!registry.hasPlugin("FlutterDownloaderPlugin")) {
       FlutterDownloaderPlugin.register(with: registry.registrar(forPlugin: "FlutterDownloaderPlugin"))
    }
}
  • flutter doctor -v:
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.1 19B88, locale pt-BR)
    • Flutter version 1.12.13+hotfix.7 at /Users/JHBitencourt/Documents/
    • Framework revision 9f5ff2306b (8 weeks ago), 2020-01-26 22:38:26 -0800
    • Engine revision a67792536c
    • Dart version 2.7.0
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/JHBitencourt/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.0.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
  • Error:

image_error

@JHBitencourt
Copy link
Author

I'm closing this issue since the problem wasn't this plugin. Some flavor and runner configurations got messed up, but now everything works fine.

@tronghuy5555
Copy link

I'm closing this issue since the problem wasn't this plugin. Some flavor and runner configurations got messed up, but now everything works fine.

Hi @JHBitencourt , how do you fix that? Could you show the code?

@batteryfull
Copy link

Screen Shot 2020-03-27 at 23 35 17

I was facing the same issue, tried to fix but no luck... @JHBitencourt Can you share with me the right config which fixed the issue?

@sunkaigoon
Copy link

Target iOS 9.0 to fix it.

@batteryfull
Copy link

thanks @sunkaigoon , I changed all of the targets to iOS 9.0, but still no luck... Will other configure need to be set too?

@hnvn
Copy link
Member

hnvn commented Mar 31, 2020

Try to recreate ios project

flutter create -i swift .

@JHBitencourt
Copy link
Author

JHBitencourt commented Mar 31, 2020

@tronghuy5555 @batteryfull as I said my problem was because I have custom schemes, and my prod scheme was pointing to the build configuration of other one in the archive phase.

image

So neither changing target to iOS 9.0 or recreating ios project would work. And this last one is not indicated if you have custom configurations.

@batteryfull
Copy link

Many thanks, @hnvn and @JHBitencourt on your advise and update. But setting targets to iOS 9.0, re-create ios project but the error still present. I was using a custom scheme for different flavours and worked fine previously.
I did try a brand new flutter project and it works as expected after import flutter_downloader, I am trying to whether there is a conflict with other objective-C libs I was using.
I am open to your further advice on solving this issue as this is slowing us down.

Again thank you all!

@hnvn
Copy link
Member

hnvn commented Apr 1, 2020

I have faced this kind of issue when I customize Xcode project with many flavours (build target). In my case, I recreate a simpler project to make sure the plugin work and compare the Xcode project setting of the working project with my original project line-to-line, it will point you out how to correct the project setting.

@befirst
Copy link

befirst commented Apr 6, 2020

I have faced the same issue, made Product->Clean and Product->Build, its fixed the problem for me

@MunishThakur
Copy link

Any update on this. I am also facing "No such module 'flutter_downloader'" issue. I tried every step mentioned in the thread but nothing worked.

@KarimMohamed20
Copy link

Open xcworkspace instead of xcodeproj and it will work fine

@pengxueshan
Copy link

I am also facing "No such module 'flutter_downloader'" issue (debug mode is fine).

@pengxueshan
Copy link

flutter/flutter#43986 (comment)
This comment resolve my problem.

@SkynetVirus
Copy link

image
Just change deployment target to 9.0 then everything worked well

@nivla360
Copy link

nivla360 commented Aug 3, 2020

None of the above solutions worked for me so this is how I solved mine:

  1. Run flutter clean
  2. Open the project folder navigate to ios directory and delete the 'Pods' folder
  3. Open terminal and navigate to ios directory in your project folder and run pod install
  4. When done, open 'Runner.xcworkspace'
  5. In Xcode, clean the build folder by going to Product > Clean Build Folder
  6. Build the project (Product > Build) and everything should work fine.

@surveshoeb
Copy link

@nivla360 Thanks it worked for me.

@dthuering
Copy link

Also check if your iOS Deployment Target matches the Podfile platform setting.

@YuanSamuel
Copy link

@nivla360 Worked for me! I had to do some pod updates stuff as well, but right after building, it worked! I opened the ios folder instead on step 4, but there shouldn't be much of a difference.

@paakjis
Copy link

paakjis commented Jun 8, 2022

None of the above solutions worked for me so this is how I solved mine:

  1. Run flutter clean
  2. Open the project folder navigate to ios directory and delete the 'Pods' folder
  3. Open terminal and navigate to ios directory in your project folder and run pod install
  4. When done, open 'Runner.xcworkspace'
  5. In Xcode, clean the build folder by going to Product > Clean Build Folder
  6. Build the project (Product > Build) and everything should work fine.

Also had to restart Xcode.

@opsquid
Copy link

opsquid commented Feb 24, 2023

Open xcworkspace instead of xcodeproj and it will work fine

This solved my problem. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests