Hi, during works on build automation with PostProcessBuild, I found out that ProjectCapabilityManager.AddInAppPurchase() doesn’t adds In App Purchase capability on XCode project.
Things like AddGameCenter() and AddPushNotifications() works well, but only in-app purchase.
Are there anything I missed or it’s just a bug? I checked out that provisioning profile surely contains In App Purchase feature.
While adding Sign In With Apple capabilities I noticed the ProjectCapabilityManager was not working properly with Unity 2019.4. Basically the moment they divided the whole thing in 2 targets (UnityFrameworkTarget and UnityMainTarget)
What I noticed is that whenever you have an iOS feature that requires to add (1) a Framework and (2) a Capability in the entitlements file you need to:
Add (1) to the UnityFramework target
And (2) to the Main app target.
At least, that’s my experience when trying to add Sign In With Apple programatically on that Unity version.
May I ask, why do you need In App Purchase capability? Are you using native IAP code? Alternatively, you can use Unity IAP which handles all of this for you.
I thought if I use any IAP-Related functions, It’s necessary to include iap capability. If Unity IAP handles all for me, then that’s fine - but still, it feels quite a strange behaviour and I’d like to see any warning message or something if I don’t get some result as I expected…
Oh… may I ask, If ProjectCapabilityManager.AddInAppPurchase() doesn’t add In-App Purchase capability to project, then what’s its expected behavior??
Maybe I misunderstood something about what ProjectCapabilityManager class really does, but official documentation says ‘This class allows you to add and modify the specifics of Xcode project capabilities’.
So, If I have serious mistake on understanding this class or function, please let me know and it’ll be really helpful.
A more detailed explanation on its expected behavior would also be good.
What problem are you trying to solve? Sorry, I don’t know the answer to your question. Does IAP work for you? I’ve built many IAP projects in XCode, and never had to touch that setting.
Some people might have some custom native code or a different plugin to handle the IAP. The question is not whether they are using Unity’s IAP plugin. The question here is why AddInAppPurchase does NOT add the capability to the project properly.
The answer is ProjectCapabilityManager might not be working properly after Unity splitted the generated Xcode projects in two targets, on Unity 2019.4 (UnityFramework target & Main App target).
If the manager is created with the target returned with GetUnityFrameworkTargetGuid, the required frameworks are added properly, but the capabilities are not added properly
If the manager is created with the target from GetUnityMainTargetGuid, the capabilities are added properly, but the frameworks are not added properly, unless you mark them in the editor configuration tab for one native iOS file (a .m file for example)
I think the way to fix this issue is that Unity’s team fixes the ProjectCapabilityManager to accept BOTH targets, the unity framework, and the main app; and readapts the code inside it so frameworks are added to the UnityFramework target, and capabilities are added to the main app target.
I don’t think you need to add in-app purchase capability manually. however after unity changed the structure,
I’ve found that the in-app purchase capability does not appear in the capabilities unless you add the storekit.framework into the main app target.if you try to add in-app purchase capability manually on xcode you’ll see that the storekit.framework added to the frameworks automatically.so I guess, storekit.framework is connected with capabilities and this is expected behaviour.