bndkt / react-native-app-clip

Easily add an App Clip for iOS apps built with React Native
https://bndkt.com/blog/2022/react-native-app-clip
446 stars 19 forks source link

Submission fails with UIBackgroundModes configured #25

Open nahn20 opened 9 months ago

nahn20 commented 9 months ago

Cause

This issue occurs when expo.ios.infoPlist.UIBackgroundModes is configured in app.json. In my case, with ["fetch", "remote-notification"]. This causes the error Invalid Info.plist key. App clip "APP CLIP NAME HERE" contains Info.plist keys. App clips cannot contain UIBackgroundModes. Remove UIBackgroundModes from the Info.plist of your app clip. when submitting using eas submit. Looking into Info.plist of the Clip target, UIBackgroundModes is copied from the main app's Info.plist.

Temporary Fix

To get around this issue, I added a check for the key UIBackgroundModes in withAppClipPlist.ts. Effectively just a check for config.ios?.infoPlist && key !== "UIBackgroundModes" && (infoPlist[key] = config.ios.infoPlist[key]);.

Potential Solutions

I haven't been able to find good documentation by Apple on which plist keys will cause issues, so this might become a game of whack-a-mole for hunting down invalid copied keys. Potential solutions could either involve adding keys to a blocklist as issues pop up, or allow configuration within the plugin (perhaps similar to the existing infoPlist except specific to react-native-app-clip?).