Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Can't compile for iOS #8

Open
apalala-dev opened this issue Jan 25, 2021 · 3 comments
Open

Can't compile for iOS #8

apalala-dev opened this issue Jan 25, 2021 · 3 comments

Comments

@apalala-dev
Copy link

Hello and thank you for this package !

It is working fine on Android but I have this error on iOS :

Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Xcode build done.                                           10,1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    Command CompileSwift failed with a nonzero exit code
    /Users/seb/dev/flutter/.pub-cache/hosted/pub.dartlang.org/extended_shared_preferences-1.0.3/ios/Classes/SharedpreferencesPlugin.m:8:9: fatal error: 'sharedpreferences-Swift.h' file not found
    #import "sharedpreferences-Swift.h"
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    Command CompileSwift failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Exited (sigterm)

I don't know much about iOS, it may be an error related to my config ? Do you have any idea on how to fix it ?

I tried doing a flutter clean, deleting Pods directory then doing a pod install and in XCode doing Product > Clean Build Folder but nothing worked.

I am using extended_shared_preferences: ^1.0.3

@marlokessler
Copy link
Owner

As far as I know, this happens when the iOS compatibility header is not copied during compilation. I experienced that sometimes, too. Nevertheless, I never found a generic solution since it can be caused by multiple things. A whole forum discussion can be found here: https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816. But as far as I know it is not caused by the plugin itself. Could you uninstall it and try if the other plugins you installed still work?

@apalala-dev
Copy link
Author

I uninstalled the app on the Simulator and tried to run my app again on it with the same result (build error).

After that, I commented the extended_shared_preferences: ^1.0.3 line in the pubspec.yaml and commented all the code that depended on that plugin and tried again to run on the Simulator and it worked fine.

I added again the plugin and I ran again in the same problem, being not able to run my app on iOS.

I also have this in the Output window of VS Code :

[ios/.symlinks/plugins/extended_shared_preferences] flutter pub get
Running "flutter pub get" in extended_shared_preferences-1.0.3...     
Cannot open file, path = '/Users/seb/dev/flutter/.pub-cache/global_packages/extended_shared_preferences/pubspec.lock' (OS Error: No such file or directory, errno = 2)
pub get failed (66; Cannot open file, path = '/Users/seb/dev/flutter/.pub-cache/global_packages/extended_shared_preferences/pubspec.lock' (OS Error: No such file or directory, errno = 2))
exit code 66

It might be linked to the problem ?

@nandakav
Copy link
Contributor

nandakav commented Jul 2, 2021

This is a blocker for me as well. I need to maintain 2 code bases for ios and android as this breaks the ios build.

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

No branches or pull requests

3 participants