SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.24k stars 741 forks source link

Include SwiftMessages in App and Extension with Cocoapods #552

Open christophli opened 3 weeks ago

christophli commented 3 weeks ago

I have troubles including the pod in my main app project and an extension at the same time. For my main app it always includes the "App" part and the "AppExtension" extension part in the search paths. This causes that no notification banners are shown because the SWIFTMESSAGES_APP_EXTENSIONS flag is set in the main app as well

This behaviour is reproducible in the iMessageDemo-Project.

Steps to reproduce:

Add pod 'SwiftMessages/App', '~> 10.0.0' to the target iMessageDemo and run pod install

You can see that in the file Pods-iMessageDemo.debug.xcconfig both App and AppExtension are included in the search paths.

Did anyone have the same problem and knows how to solve it?

wtmoose commented 1 week ago

I don't know off the top of my head, but I'll take a look if you can provide a sample project. Otherwise, I'd suggest posting this on StackOverflow.

christophli commented 1 week ago

Thank you so much. I attached a sample project: iMessageDemo.zip

It is the iMessageDemo-Project from your repo where i added the pods for the app itself and the extension, a scheme to run the main app and a ViewController to trigger the notification. I am using as presentationContext .automatic, so I changed this too. With setting it to .viewController(self) it would work (but maybe other parts won't, as the makro is still set for the main app)

This is my output in the search paths for the app

Wrong search paths

If you run the demo app, you will see that the notifications are not working. If you search for the makro in the pod you can see that it is set

makro