LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 342 forks source link

Crash on Xcode 13. Can't open app #482

Closed ghost closed 3 years ago

ghost commented 3 years ago

Describe the Bug I can't run my app on an actual phone after updating to Xcode 13. Here is the crash log in the console:

dyld[374]: Library not loaded: @rpath/LNPopupController.framework/LNPopupController
  Referenced from: /private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/MyApp
  Reason: tried: '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/System/Library/Frameworks/LNPopupController.framework/LNPopupController' (no such file)
Library not loaded: @rpath/LNPopupController.framework/LNPopupController
  Referenced from: /private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/MyApp
  Reason: tried: '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopupController' (no such file), '/private/var/containers/Bundle/Application/9B29C285-353C-4396-A000-E0A25FD86C11/MyApp.app/Frameworks/LNPopupController.framework/LNPopup

Any thoughts on this? Is it because of dynamic vs static library? I'm using dynamic

To Reproduce Steps to reproduce the behavior:

  1. Get Xcode 13
  2. Get an actual iPhone on iOS 15. Don't use a simulator.
  3. Install LNPopupController with SPM and select dynamic option only. The version I have is 2.12.6
  4. Run the app and it will crash

Expected Behavior n/a

Screenshots n/a

Additional Context n/a

LeoNatan commented 3 years ago

Yes, this seems like an issue with Xcode. Make sure in your project settings, General -> Frameworks, Libraries and Embedded Content, make sure that LNPopupController is maked as "Embed & Sign". I have a feeling it's "Do Not Embed" for you.

ghost commented 3 years ago

Yep, you're right! Thank you!

So for my app I chose:

Dynamic:

dynamic

I changed this to Embed & Sign:

embed

It seems that Static worked without changing anything Embed/Sign, but I believe you said to use Dynamic for app in an older issue.

Thanks for helping!

LeoNatan commented 3 years ago

It’s a personal preference with slightly different performance characteristics.

but I do believe this is an Xcode bug. The common case is that you want a dylib/framework to be embedded and signed.

ghost commented 3 years ago

@LeoNatan Got it ok, I was referring to this issue btw: https://github.com/LeoNatan/LNPopupController/issues/422

Is using Dynamic a best practice for your library in a regular app (not a framework)?

LeoNatan commented 3 years ago

I prefer dynamic frameworks (dylibs) for many reasons. It’s one of these eternal battles like spaces or tabs 😆. You can Google for “static vs dynamic linking what is better” and see the arguments for that or that. But both will work just as fine for you, just need to make sure Xcode is set up correctly. 👍

ghost commented 3 years ago

ooooh I see, I thought it was a requirement to use Dynamic lol Thank you for clarifying that! As always, great library and love the work being put in to maintain it.

LeoNatan commented 3 years ago

Thank you for the kind words! Happy coding! Also check out LNPopupUI if you dabble in SwiftUI.