简体   繁体   中英

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

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!

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.

Xcode successfully archived my application, but the Archives Organizer does not list my archive.

The Organizer may not list your archive after a successful Product > Archive for any of the following reasons:

1 - The Reveal Archive in Organizer option is disabled for your app in the scheme Editor's Archive pane. In Xcode, open the scheme editor by choosing Product > Scheme > Edit Scheme …, then select Reveal Archive in Organizer in the Archive pane.

2 - The Skip Install build setting is set to YES in your Build Settings pane. Skip Install ( SKIP_INSTALL ) must be set to YES for static libraries and NO for applications.

3 - The Installation Directory (INSTALL_PATH) build setting was not properly set in your Build Settings pane.

Set this build setting to $(LOCAL_APPS_DIR) , the default value for applications.

Technical Note TN2215

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM