OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

[Bug]: Crash on startup for Library not loaded: @rpath/OneSignalCore.framework/OneSignalCore #1227

Closed peterpaulis closed 3 weeks ago

peterpaulis commented 1 year ago

What happened?

updated pods, the app crashes during launch on

Library not loaded: @rpath/OneSignalCore.framework/OneSignalCore

tried Clean and

rm Podfile.lock
pod cache clean --all
pod install --repo-update

Steps to reproduce?

1. pod update
2. clean, build and run on real device

What did you expect to happen?

OneSignal iOS SDK version

OneSignalXCFramework 3.12.3

iOS version

15

Specific iOS version

iOS 16.2, XCode Version 14.2 (14C18)

Relevant log output

dyld[78163]: Library not loaded: @rpath/OneSignalCore.framework/OneSignalCore
  Referenced from: <A32B474F-9332-3CED-90EB-2D2361F63724> /private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/DennikN
  Reason: tried: '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/preboot/Cryptexes/OS@rpath/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/System/Library/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache)
Library not loaded: @rpath/OneSignalCore.framework/OneSignalCore
  Referenced from: <A32B474F-9332-3CED-90EB-2D2361F63724> /private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/DennikN
  Reason: tried: '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCore.framework/OneSignalCore' (errno=2), '/private/var/containers/Bundle/Application/251D6108-2592-44AC-8CE9-175B0F1763CF/DennikN.app/Frameworks/OneSignalCo
dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
(lldb)

Code of Conduct

peterpaulis commented 1 year ago

my pod

platform :ios, '13.0'
inhibit_all_warnings!

def app_pods

  use_frameworks!

  # SDKs
  pod 'OneSignalXCFramework'
....
emawby commented 1 year ago

Hello thank you for reaching out. We have seen this error in some of our wrapper SDKs maybe those threads will help.

Make sure you are using Cocoapods 1.11.3 and try the below code after update. We have seen this issue when using versions lower than 1.11.3. Also, make sure you are using ruby 2.7.5+. We believe Cocoapods 1.11.3 has an FFI dependency that requires a higher ruby version than what you may be using.

rm Podfile.lock
pod cache clean --all
pod install --repo-update
anatoly-spb commented 1 year ago

The same issue when run project from xcode:

image

Out project is based on cordova with onesignal-cordova-plugin 3.3.0 :

+ ionic info

Ionic:

   Ionic CLI                     : 6.20.8 (/Users/jenkins/jenkins_slave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node16.19.0/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.5.4
   @angular-devkit/build-angular : 15.1.6
   @angular-devkit/schematics    : 15.1.6
   @angular/cli                  : 15.1.6
   @ionic/angular-toolkit        : 8.0.0

Cordova:

   Cordova CLI       : 11.1.0
   Cordova Platforms : ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 7 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 1.7.1

System:

   ios-deploy : 1.11.4
   ios-sim    : 8.0.2
   NodeJS     : v16.19.0 (/Users/jenkins/jenkins_slave/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node16.19.0/bin/node)
   npm        : 8.19.3
   OS         : macOS Monterey
   Xcode      : Xcode 14.2 Build version 14C18

Podfile:

# DO NOT MODIFY -- auto-generated by Apache Cordova
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
use_frameworks!
target 'rda' do
    project 'rda.xcodeproj'
    pod 'OneSignalXCFramework', '3.12.3'
end

Podfile.lock:

PODS:
  - OneSignalXCFramework (3.12.3):
    - OneSignalXCFramework/OneSignalCore (= 3.12.3)
    - OneSignalXCFramework/OneSignalExtension (= 3.12.3)
    - OneSignalXCFramework/OneSignalOutcomes (= 3.12.3)
  - OneSignalXCFramework/OneSignalCore (3.12.3)
  - OneSignalXCFramework/OneSignalExtension (3.12.3):
    - OneSignalXCFramework/OneSignalCore
    - OneSignalXCFramework/OneSignalOutcomes
  - OneSignalXCFramework/OneSignalOutcomes (3.12.3):
    - OneSignalXCFramework/OneSignalCore

DEPENDENCIES:
  - OneSignalXCFramework (= 3.12.3)

SPEC REPOS:
  trunk:
    - OneSignalXCFramework

SPEC CHECKSUMS:
  OneSignalXCFramework: 75844c29607ca95e6176f6f21257b4382c7fdbfb

PODFILE CHECKSUM: 6fa501b03e19ac918fe9af923be039d6e8cfdea3

COCOAPODS: 1.11.3

System:

#system ruby:
>/usr/bin/ruby --version
ruby 2.6.10p210
#user ruby installed with rbenv and selected with rbenv global 3.2.1 command
>ruby --version
ruby 3.2.1 (2023-02-08...)
>pod --version
1.11.3

Steps to reproduce:

>install nodejs 16.9
>npm install -g cordova@11.1.0 cordova-res@0.15.4 native-run@1.7.1 @ionic/cli@6.20.8
>git clone https://github.com/anatoly-spb/ionic6-hello.git
>cd ionic6-hello
>node install 
>ionic cordova platforms add ios@6.2.0
>cd platforms/ios
>pod repo update
>pod install
>cd ../..
>ionic cordova build ios
open workspace from platforms/ios in xcode and try to run simulator

Any hints are welcome! Thank you!

anatoly-spb commented 1 year ago

I have downgraded to onesignal-cordova-plugin@3.2.0 with 'OneSignalXCFramework', '3.11.2' and it solved the problem. So the problem is between 3.11.2 and 3.12.3 versions of OneSignalXCFramework.

nan-li commented 1 year ago

Hi @anatoly-spb, Thanks for reporting. I see:

#system ruby:
>/usr/bin/ruby --version
ruby 2.6.10p210
#user ruby installed with rbenv and selected with rbenv global 3.2.1 command
>ruby --version
ruby 3.2.1 (2023-02-08...)

I suspect the ruby version that is is actually used to build may be the system ruby 2.6.10p210. We have seen this crash resolve for most once they use Cocoapods 1.11.3 and ruby 2.7.5+.

Can you confirm, or make sure xcode is indeed using ruby 3.2.1?

anatoly-spb commented 1 year ago

Hi @anatoly-spb, Thanks for reporting. I see:

#system ruby:
>/usr/bin/ruby --version
ruby 2.6.10p210
#user ruby installed with rbenv and selected with rbenv global 3.2.1 command
>ruby --version
ruby 3.2.1 (2023-02-08...)

I suspect the ruby version that is is actually used to build may be the system ruby 2.6.10p210. We have seen this crash resolve for most once they use Cocoapods 1.11.3 and ruby 2.7.5+.

Can you confirm, or make sure xcode is indeed using ruby 3.2.1?

If xcode uses user's profile, so it must be ruby 3.2.1. Could you please point me how to check it?

Another question is how do you explain that downgrade to previous version solve this problem? It seems to me something wrong is between 3.11 and 3.12 versions.

emawby commented 1 year ago

@anatoly-spb We have not been able to reproduce the issue going between 3.11 -> 3.12 with Ruby 3.2.1, but I noticed that a Cocoapods update was released and it explicitly requires a higher Ruby version. You could try updating Cocoapods.

KhurramIqbal87 commented 1 year ago

@anatoly-spb @peterpaulis @nan-li @emawby The issue is related. it expect One Signal XC Frameworks in debug-iPhoneSimulator where as it creates one more folder for OneSignalXCFramework and paste all dyld under that folder as a resultant dyld not found in Debug-iPhoneSImulator. so copy paste all the folder in Debug iPhoneSimulator

Attach is the screen shot

Screenshot 2023-04-11 at 3 01 14 AM

Copy all the folder under OneSingalXCFramework and paste it Debug-iPhoneSimulator

What I believe it is releated to Cocoapod version or may be not. I Faced the same issue on other project on our Company own framework while one of the other colleague was not facing such issue.

emawby commented 1 year ago

@KhurramIqbal87 Ah good find that is good to know! Have you tested on the 1.12.+ version of Cocoapods? Cocoapods had not released an update for almost a year but finally did and should have better support for the latest Xcode version.

ahmedsafadii commented 1 year ago

SAME ISSUE WITH SPM

emawby commented 1 year ago

@ahmedsafadii Hello do you have an example project with SPM that can reproduce this issue? I have not been able to reproduce this issue using SPM. Which Xcode version are you using?

ahmedsafadii commented 1 year ago

@ahmedsafadii Hello do you have an example project with SPM that can reproduce this issue? I have not been able to reproduce this issue using SPM. Which Xcode version are you using?

Version 14.2 (14C18)

KarimSakr commented 11 months ago

SAME ISSUE WITH SPM

same

nan-li commented 3 weeks ago

Hi, we have had no further reports of this. Please upgrade the OneSignal SDK if you or anyone is still having this issue. If this is still an issue, please open a new report with updated information.