OneSignal-Flutter-SDK icon indicating copy to clipboard operation
OneSignal-Flutter-SDK copied to clipboard

Missing Headers <OneSignal/OneSignal.h> (Cocoapods issue)

Open Nightsd01 opened this issue 8 years ago • 78 comments

When using 1.0.2 of our Flutter SDK, some users that uses use_frameworks! in their podfiles (Swift projects) may see the following error:

Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    In file included from /Users/bradhesse/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.2/ios/Classes/OneSignalPlugin.m:28:
    /Users/bradhesse/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.2/ios/Classes/OneSignalPlugin.h:29:9: fatal error: 'OneSignal/OneSignal.h' file not found
    #import <OneSignal/OneSignal.h>
            ^~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

It appears to be an issue with how our Flutter SDK is unable to find headers for the native iOS SDK. I am working on this issue now.

Nightsd01 avatar Sep 13 '18 00:09 Nightsd01

Created an issue with Cocoapods here: https://github.com/CocoaPods/CocoaPods/issues/8090

Nightsd01 avatar Sep 13 '18 01:09 Nightsd01

When I run pod install from my terminal, I'm getting the following message...

[!] Unable to find a specification for OneSignalDynamic (< 3.0, >= 2.8.8) depended upon by onesignal

CharlesCleveJr avatar Sep 13 '18 23:09 CharlesCleveJr

@CharlesCleveJr Can you try running pod repo update?

Nightsd01 avatar Sep 14 '18 01:09 Nightsd01

@CharlesCleveJr Can you try running pod repo update?

Thanks! This fixed the OneSignalDynamic (< 3.0, >= 2.8.8) for me.

cspags avatar Sep 17 '18 20:09 cspags

I'm trying to use version 1.0.2 and I am not using Swift in my project. I do not see use_frameworks! in any of my project files. Getting a different header error about Flutter.h file not found when trying to run. Pod install completes just fine.

Is there a workaround for this? Reverting to version 1.0.0 and 1.0.1 did not help.

There was another strange problem I ran into while adding this plugin to my project after adding the OneSignal pod requirement as tracked here: https://github.com/flutter/flutter/issues/19338

I'm not sure if that issue might be related to this problem? The only way I was able to work around the above issue was by creating a /Users/Projects folder. Then I also ran into this issue: https://github.com/flutter/flutter/issues/20685

And used the workaround there to get to this missing header bug.

Also noting that I get the same problem when using the example app checked out from this repository. The only things I modified were the Bundle Identifiers to get the build to pass before blowing up on missing headers.

In file included from /Users/mose/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalCategories.m:28: /Users/user/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalCategories.h:29:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 6 warnings and 1 error generated. In file included from /Users/mose/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalTagsController.m:28: /Users/user/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalTagsController.h:29:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~

hayatae avatar Sep 23 '18 03:09 hayatae

@CharlesCleveJr Can you try running pod repo update?

Thanks! This fixed the OneSignalDynamic (< 3.0, >= 2.8.8) for me.

I also ran into this issue and only found the fix in this unrelated issue. Can the documentation be updated to include the pod repo update step? https://documentation.onesignal.com/docs/flutter-sdk-setup

hayatae avatar Sep 23 '18 03:09 hayatae

Any update?

lubritto avatar Sep 27 '18 13:09 lubritto

Everything builds correctly in flutter but in XCode I'm getting the following error on my OneSignalExtension target ld: library not found for -lBolts clang: error: linker command failed with exit code 1 (use -v to see invocation)

CharlesCleveJr avatar Sep 30 '18 20:09 CharlesCleveJr

I got around the lBolts clang error I think and now I'm getting this... ld: '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a(BFAppLink.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Never seen it before. Any ideas?

CharlesCleveJr avatar Sep 30 '18 21:09 CharlesCleveJr

Any updates?

muarifer avatar Oct 01 '18 21:10 muarifer

I got around the lBolts clang error I think and now I'm getting this... ld: '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a(BFAppLink.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Never seen it before. Any ideas?

Do you remove "use_frameworks!"?

muarifer avatar Oct 02 '18 07:10 muarifer

No. I did disable bitcode on the Notification Service Target and it successfully built in XCode and Flutter. This wouldn't cause any errors when I archive and push to Apple would it?

CharlesCleveJr avatar Oct 02 '18 18:10 CharlesCleveJr

@Nightsd01 any updates on this?

rlee1990 avatar Oct 09 '18 02:10 rlee1990

Try to comment "use_frameworks!"

anderscheow avatar Oct 09 '18 08:10 anderscheow

Try to comment "use_frameworks!"

By then, Other plugins didn't work.

muarifer avatar Oct 09 '18 09:10 muarifer

@Nightsd01 Any updates?

rostopira avatar Oct 10 '18 15:10 rostopira

@Nightsd01 any update this is critical

rlee1990 avatar Oct 11 '18 14:10 rlee1990

I've done some more research recently and didn't make a lick of progress. For now, my only recommendation is to not use any Swift in your project and comment out use_frameworks! from your Podfile.

We will continue to investigate this since it doesn't seem like the issue in Cocoapods isn't making any headway

Nightsd01 avatar Oct 11 '18 18:10 Nightsd01

@Nightsd01 that is not an option firebase alone requires use_frameworks

rlee1990 avatar Oct 11 '18 18:10 rlee1990

@rlee1990 firebase does not requires it, I use firebase auth and database currently without any issues

rostopira avatar Oct 11 '18 19:10 rostopira