Post

Replies

Boosts

Views

Activity

NS_EXTENSION_UNAVAILABLE and Preprocessor Macros not working in Cocoapod
I have a NotificationExtension that shares a codebase with a main application, but should not run some of the code. For a long time I've used NS_EXTENSION_UNAVAILABLE in Objective C on some methods that should not be used in the extension, but in tracking down a recent bug I noticed that those methods are being called in a CocoaPod where they should not (because of NS_EXTENSION_UNAVAILABLE). I verified this when running the Extension target in XCode and setting breakpoints. I also have a Preprocessor Macro "TARGET_IS_NOTIFICATION=1" in the extension Build Settings and a Swift Active Compilation Condition to filter out some other code inside shared methods/functions. When I realized NS_EXTENSION_UNAVAILABLE wasn't working, I tried the Preprocessor Macro and found that wasn't working in the CocoaPod either. If I use the Preprocessor macro in the main Extension class, it works correctly, but when used in the Cocoapod that is called by the extension, it does not. I am currently using XCode 13.3 on an M1 Macbook Pro. I do remember that a few weeks ago XCode updated itself and stopped building so that paths needed to be changed, but I think that is all straightened out and everything else seems to be working normally.
3
0
795
Mar ’22