We use CoreNFC feature for few clients. For clients who don't use NFC or add NFC related permission, the app is rejected on App Store.
is there a way to make CoreNFC optional in the library and not lead to app store rejection for parent app who do not use this feature?
If I understand correctly, you are the third party supplying a library that includes NFC functionality your clients are not using.
Not knowing what these apps are, how they are built, and what the actual rejection causes are etc., I can't make any comments or promises about the success of this solution, but the answer to your question about making CoreNFC optional is this: (things might look/work differently depending on which Xcode version or possibly 3rd party build tools your clients are using, but this is the general gist)
In the Xcode project Build Phases, the "Link Binary With Libraries” section, add the CoreNFC.framework, and then mark it as Optional
This will weak link CoreNFC, and unless there is code that is referencing it, CoreNFC will not be included in the build.
For that, you could make use of a custom Info.plist
entry to check if the app is supposed to be using CoreNFC and not engage any features of your app that would require the use of those features.
Again, a lot of the specifics will depend on what the rejections are exactly for, what the apps are trying to do, and how they are built.
If CoreNFC is the main cause of headaches for your clients, you could also consider shipping a version without any references to it to make configuring and building their projects easier.