Xcode iOS app not prompting for network access in release build (archive)

Viewed 245

I am building a react-native iOS app that uses the JWPlayer iOS SDK v4 with chrome casting enabled.

As per the JWPlayer and Google Cast docs, I have added the Access WiFi Information capability in Xcode and added NSLocalNetworkUsageDescription and NSBluetoothAlwaysUsageDescription to info.plist.

When a run the app from Xcode on my (real) iPhone, everything works perfectly. The Bluetooth access prompt appears when the app is opened and then when the Chrome-cast button is pressed in the JWPlayer, it prompts for network access - the player handler is able to successfully discover and connect to cast devices.

However, when I archive the app in Xcode for testing via the Ad-hoc, Developer or TestFlight distribution methods, neither the Bluetooth or Network Access prompts are triggered and as a result, JWPlayer is unable to discover any cast devices.

I've checked the info.plist file located at /Users/jonathanredford/Library/Developer/Xcode/Archives/2021-09-30/[AppName] 30-9-21, 3.19 pm.xcarchive/Products/Applications/[AppName].app/info.plist to confirm that both NSLocalNetworkUsageDescription and NSBluetoothAlwaysUsageDescription are in there, which they are.

I've followed solutions to similar issues but have not had any success yet.

One of these solutions said to ensure that when viewing the info.plist in Xcode, make sure the target app is checked/selected in the File Inspector on the right side. Doing this causes the archive to fail with the following error:

1) Target '[AppName]' (project '[AppName]') has copy command from '/Users/jonathanredford/.../Projects/[AppName]/ios/[AppName]/Info.plist' to '/Users/jonathanredford/Library/Developer/Xcode/DerivedData/[AppName]-byufdhksjujqvwfyfegsqgpdvhow/Build/Intermediates.noindex/ArchiveIntermediates/[AppName]/InstallationBuildProductsLocation/Applications/[AppName].app/Info.plist'
2) Target '[AppName]' (project '[AppName]') has process command with output '/Users/jonathanredford/Library/Developer/Xcode/DerivedData/[AppName]-byufdhksjujqvwfyfegsqgpdvhow/Build/Intermediates.noindex/ArchiveIntermediates/[AppName]/InstallationBuildProductsLocation/Applications/[AppName].app/Info.plist'

Thank you in advance!

1 Answers

Are you doing all of the testing on the same device? I recommend fully deleting the app before installing it and testing it, especially when debugging build issues like this. There may be a cached permission that isn't working, but also isn't triggering the request.

The next step to debug something like this is to side-load as you have been, but in the build configuration. This will help narrow down build configuration issues. You can find these settings by editing the build scheme and looking under Run and in the Info tab. All of your testing uses Debug configuration, but archiving should use the Release configuration. It is safest to duplicate the scheme before messing with it so that you don't destroy your testing setup.

Related