iOS: Enabling In-App Purchases through the CMake Interface

Hi there,

I’m currently trying to enable In-App Purchases for an iOS AUv3 plugin built with the JUCE CMake interface. I was able to get my code to compile using

target_link_libraries(MyPlugin PRIVATE juce::juce_product_unlocking)
target_link_libraries(MyPlugin PRIVATE "-framework StoreKit")
target_compile_definitions(MyPlugin PUBLIC JUCE_IN_APP_PURCHASES=1)

But to actually enable In-App Purchases, I then need to open the project in Xcode and manually add the capability for In-App Purchases. Is there a way to automate this process with CMake? Maybe @reuk would have an idea?


Annoyingly, I’m not sure that this is possible. In the Projucer, it looks like this is achieved by adding a block like SystemCapabilities = { = { enabled = 1; }; }; to the generated pbxproj file. However, I can’t find a way to add this block from CMake.

I’d also be interested to hear if anyone has managed to find a solution to this problem.

So, it looks like this works:


it just doesn’t show in Xcode, under the “Capabilities” list.

Interesting, how did you discover that? I checked the Xcode build settings reference for an option which would enable in app purchases and couldn’t find anything.

I had found this StackOverflow post about adding the “Hardened Runtime” capability, and took a guess as to what the equivalent might be for In-App Purchase. It works for my local sandboxed testing, but I don’t know if that’s different from how things work when the app is actually released.