swift – For an iOS app with an iMessage extension, know in code whether or not you are operating within the extension or app?


I am constructing an iOS app with an iMessage extension. I am on the lookout for a solution to detect (ideally precompilation by way of a preprocessor flag) whether or not you are operating in app extension or the primary app.

I discovered this query, however the reply now not works since in XCode 14, precompiler flags can solely be utilized to the undertaking, not goal settings. The right way to detect if code is operating in Important App or App Extension Goal?

I additionally explored including customized construct configurations, however I do not suppose that is a sublime answer both, since chances are you’ll wish to nonetheless preserve Debug/Launch distinction for iMessage and core app targets.

I am shocked iOS would not have a greater answer for this

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles