Onesignal-flutter-sdk: Example fails to run on newest Flutter

Created on 14 Nov 2018  Â·  12Comments  Â·  Source: OneSignal/OneSignal-Flutter-SDK

Description:

I just cloned the Flutter SDK and went to the examples and did a flutter run -- it failed with the following:

Error output from Xcode build:
↳
* BUILD FAILED *

Xcode's output:
↳
ld: warning: directory not found for option
'-L/Users/sjm/play/OneSignal-Flutter-SDK/example/build/ios/Debug-iphonesimulator/onesignal'
ld: library not found for -lonesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)

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

Environment

Steps to Reproduce Issue:

  1. Follow the instructions as specified at: API Doc Link
  2. The "flutter run" fails ..

Anything else:

(crash stacktraces, as well as any other information here)

Most helpful comment

I found a workaround and was able to archive the project, so I cannot show you the log right now, but I'll try to remove my change and see if the error come back.
But let me describe what I did, maybe it would help.
First of all, I've started using OneSignal Flutter library while ago, and it worked fine until I've added Google Map Flutter library to the project and made Flutter upgrade.
Android build worked fine. I was able to make iOS build but noticed a strange message which appears and disappeared during the build, saying something like The process takes too much time.
Here is what happened next:

  • XCode failed to make an archive of the build for AppStore deployment. The error was as I mentioned above.
  • I've cleaned up XCode:
rm -rf ~/Library/Developer/Xcode/DerivedData/
  • Cleaned flutter:
flutter clean
  • Updated pods:
pod update
  • Run the build again, same thing - strange message about the time out, builds fine though. Failed to make an archive, but now it was complaining about not onesignal library, but about sqflite. The error was on OneSignalNotificationServiceExtension target.

I was surprised because I don't think OneSignal is using sqflite, I know Google Maps do though.

I've been repeating the steps above and noticed that missing library sometimes is different, not onesignal, nor sqflite, something else. But in most cases, I was getting complain about sqflite.
So, after a few hours of struggling and googling, I've followed someone's suggestion about adding the missing lib as a required lib for the OneSignalNotificationServiceExtension target.

Which I did, and I was able to make the archive without even rebuilding the project and everything worked.

image

So, it could be not a problem of OneSignal, but maybe OneSignal could do something about it to avoid such problems since XCode complains about OneSignalNotificationServiceExtension target.

All 12 comments

So -- I did a few things and got it working -- at a MINIMUM better documentation is needed:

-- I changed the relative path of onesignal in the pub spec to be instead ^1.0.3 so it gets the same thing as what people would get ..

-- I went to ./ios and did a pod install .. which prompted me to update the Pod file to set the target version (which I set to 10.0).

-- flutter clean

-- flutter run

Then flutter run worked and I am seeing the Example app on the Simulator .. (in my case)

@sjmcdowall It's difficult to say what part of those steps resolved the issue since....literally all of those should be handled automatically by Flutter itself. Thanks for posting your resolution.

I had this same issue. What i did was run the command 'flutter clean' and then 'flutter run' and it worked for me.

This issue comes up when I try to Archive my app (preparing to submit to App Store). It will Build, but cannot Archive.

The example project doesn't initialize Onesignal, this is async: https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/master/example/lib/main.dart#L26

The same problem. Upgraded and cleaned flutter, build works, but when archiving in XCode getting:

ld: library not found for -lonesignal
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm on version 1.0.5

@strokine -- can you show exactly the whole error by running the command with a -v ? Yours doesn't appear to be quite the same. Have you done the steps as outlined above? I.e. manually adding dependencies to the OneSignal target? Including I guess onesignal itself ... ??

I found a workaround and was able to archive the project, so I cannot show you the log right now, but I'll try to remove my change and see if the error come back.
But let me describe what I did, maybe it would help.
First of all, I've started using OneSignal Flutter library while ago, and it worked fine until I've added Google Map Flutter library to the project and made Flutter upgrade.
Android build worked fine. I was able to make iOS build but noticed a strange message which appears and disappeared during the build, saying something like The process takes too much time.
Here is what happened next:

  • XCode failed to make an archive of the build for AppStore deployment. The error was as I mentioned above.
  • I've cleaned up XCode:
rm -rf ~/Library/Developer/Xcode/DerivedData/
  • Cleaned flutter:
flutter clean
  • Updated pods:
pod update
  • Run the build again, same thing - strange message about the time out, builds fine though. Failed to make an archive, but now it was complaining about not onesignal library, but about sqflite. The error was on OneSignalNotificationServiceExtension target.

I was surprised because I don't think OneSignal is using sqflite, I know Google Maps do though.

I've been repeating the steps above and noticed that missing library sometimes is different, not onesignal, nor sqflite, something else. But in most cases, I was getting complain about sqflite.
So, after a few hours of struggling and googling, I've followed someone's suggestion about adding the missing lib as a required lib for the OneSignalNotificationServiceExtension target.

Which I did, and I was able to make the archive without even rebuilding the project and everything worked.

image

So, it could be not a problem of OneSignal, but maybe OneSignal could do something about it to avoid such problems since XCode complains about OneSignalNotificationServiceExtension target.

I've been trying to get @Nightsd01 to acknowledge these issues ... so far they have been ignoring me ..

I found a workaround and was able to archive the project, so I cannot show you the log right now, but I'll try to remove my change and see if the error come back.
But let me describe what I did, maybe it would help.
First of all, I've started using OneSignal Flutter library while ago, and it worked fine until I've added Google Map Flutter library to the project and made Flutter upgrade.
Android build worked fine. I was able to make iOS build but noticed a strange message which appears and disappeared during the build, saying something like The process takes too much time.
Here is what happened next:

  • XCode failed to make an archive of the build for AppStore deployment. The error was as I mentioned above.
  • I've cleaned up XCode:
rm -rf ~/Library/Developer/Xcode/DerivedData/
  • Cleaned flutter:
flutter clean
  • Updated pods:
pod update
  • Run the build again, same thing - strange message about the time out, builds fine though. Failed to make an archive, but now it was complaining about not onesignal library, but about sqflite. The error was on OneSignalNotificationServiceExtension target.

I was surprised because I don't think OneSignal is using sqflite, I know Google Maps do though.

I've been repeating the steps above and noticed that missing library sometimes is different, not onesignal, nor sqflite, something else. But in most cases, I was getting complain about sqflite.
So, after a few hours of struggling and googling, I've followed someone's suggestion about adding the missing lib as a required lib for the OneSignalNotificationServiceExtension target.

Which I did, and I was able to make the archive without even rebuilding the project and everything worked.

image

So, it could be not a problem of OneSignal, but maybe OneSignal could do something about it to avoid such problems since XCode complains about OneSignalNotificationServiceExtension target.

This made my day! Been banging my head on this issue for 1 week, and this was the foolproof way to solve it

@Nightsd01 Any feedback on this? Linker is causing issues in VSC as well.

I found a workaround and was able to archive the project, so I cannot show you the log right now, but I'll try to remove my change and see if the error come back.
But let me describe what I did, maybe it would help.
First of all, I've started using OneSignal Flutter library while ago, and it worked fine until I've added Google Map Flutter library to the project and made Flutter upgrade.
Android build worked fine. I was able to make iOS build but noticed a strange message which appears and disappeared during the build, saying something like The process takes too much time.
Here is what happened next:

  • XCode failed to make an archive of the build for AppStore deployment. The error was as I mentioned above.
  • I've cleaned up XCode:
rm -rf ~/Library/Developer/Xcode/DerivedData/
  • Cleaned flutter:
flutter clean
  • Updated pods:
pod update
  • Run the build again, same thing - strange message about the time out, builds fine though. Failed to make an archive, but now it was complaining about not onesignal library, but about sqflite. The error was on OneSignalNotificationServiceExtension target.

I was surprised because I don't think OneSignal is using sqflite, I know Google Maps do though.

I've been repeating the steps above and noticed that missing library sometimes is different, not onesignal, nor sqflite, something else. But in most cases, I was getting complain about sqflite.
So, after a few hours of struggling and googling, I've followed someone's suggestion about adding the missing lib as a required lib for the OneSignalNotificationServiceExtension target.

Which I did, and I was able to make the archive without even rebuilding the project and everything worked.

image

So, it could be not a problem of OneSignal, but maybe OneSignal could do something about it to avoid such problems since XCode complains about OneSignalNotificationServiceExtension target.

I found a workaround and was able to archive the project, so I cannot show you the log right now, but I'll try to remove my change and see if the error come back.
But let me describe what I did, maybe it would help.
First of all, I've started using OneSignal Flutter library while ago, and it worked fine until I've added Google Map Flutter library to the project and made Flutter upgrade.
Android build worked fine. I was able to make iOS build but noticed a strange message which appears and disappeared during the build, saying something like The process takes too much time.
Here is what happened next:

  • XCode failed to make an archive of the build for AppStore deployment. The error was as I mentioned above.
  • I've cleaned up XCode:
rm -rf ~/Library/Developer/Xcode/DerivedData/
  • Cleaned flutter:
flutter clean
  • Updated pods:
pod update
  • Run the build again, same thing - strange message about the time out, builds fine though. Failed to make an archive, but now it was complaining about not onesignal library, but about sqflite. The error was on OneSignalNotificationServiceExtension target.

I was surprised because I don't think OneSignal is using sqflite, I know Google Maps do though.

I've been repeating the steps above and noticed that missing library sometimes is different, not onesignal, nor sqflite, something else. But in most cases, I was getting complain about sqflite.
So, after a few hours of struggling and googling, I've followed someone's suggestion about adding the missing lib as a required lib for the OneSignalNotificationServiceExtension target.

Which I did, and I was able to make the archive without even rebuilding the project and everything worked.

image

So, it could be not a problem of OneSignal, but maybe OneSignal could do something about it to avoid such problems since XCode complains about OneSignalNotificationServiceExtension target.

Many thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlirezaDaryani picture AlirezaDaryani  Â·  4Comments

Holofox picture Holofox  Â·  8Comments

sukhcha-in picture sukhcha-in  Â·  11Comments

jopicornell picture jopicornell  Â·  8Comments

xXUlquiScXx picture xXUlquiScXx  Â·  4Comments