Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PrivacyInfo.xcprivacy build issue with Expo 51 #111

Closed
lodev09 opened this issue May 10, 2024 · 17 comments
Closed

PrivacyInfo.xcprivacy build issue with Expo 51 #111

lodev09 opened this issue May 10, 2024 · 17 comments

Comments

@lodev09
Copy link

lodev09 commented May 10, 2024

Version 6.5.16-0 breaks IOS build due to invalid PrivacyInfo.xcprivacy with Expo 51.

❌  error: Multiple commands produce
'/Users/lodev09/Library/Developer/Xcode/DerivedData/XXXX.app/PrivacyInfo.xcprivacy'

I think we can safely ignore this since it will be up for the user to add the privacy file in their project. Expo does it via the app.json config.

Reverting to 6.5.11-2 works just fine.

@douglasjunior
Copy link
Owner

douglasjunior commented May 11, 2024

To use 6.5.16-0 you need to add this pod on your Podfile:

# Add temporary IQKeyboardManagerSwift fork to solve problems with PrivacyInfo.xcprivacy
pod 'IQKeyboardManagerSwift', :git => 'https://github.com/douglasjunior/IQKeyboardManager.git', :branch => 'react-native-keyboard-manager'

If you still in 6.5.11-2, you will have problems with Apple, because in this version the IQKeyboardManager have no PrivacyInfo.xcprivacy.

@lodev09

This comment was marked as off-topic.

@lodev09

This comment was marked as off-topic.

@douglasjunior

This comment was marked as off-topic.

@lodev09
Copy link
Author

lodev09 commented May 11, 2024

Have you tried building it using Expo? Maybe I missed something. All I can do is to downgrade to a lower version without the privacy manifest.

@douglasjunior
Copy link
Owner

Anyway, to use this library with expo you need to run the prebuild to get access to the native files.

https://docs.expo.dev/workflow/prebuild/

So just add this line o Podfile dependencies:

# Add temporary IQKeyboardManagerSwift fork to solve problems with PrivacyInfo.xcprivacy
pod 'IQKeyboardManagerSwift', :git => 'https://github.com/douglasjunior/IQKeyboardManager.git', :branch => 'react-native-keyboard-manager'

@lodev09

This comment was marked as off-topic.

@douglasjunior

This comment was marked as off-topic.

@lodev09

This comment was marked as off-topic.

@douglasjunior
Copy link
Owner

douglasjunior commented May 13, 2024

The version 6 was outdated by IQKeyboardManager and version 7 is incompatible with React Native yet: #109

So the only option was to fork the IQKeyboardManager version 6 and make the fix to work with the privacy manifest added only version 7.

Yes we MUST export privacy manifest for IQKeyboardManager: https://developer.apple.com/support/third-party-SDK-requirements/

Of course, it would be better to work without needing of a fork to be added to Podfile, that's obvious, and it's been like that for the last 7 years.

Unfortunately, this is how the open source world sometimes works, we need to play with the tools that we have in our hands.

@samuelbeaulieu
Copy link

samuelbeaulieu commented Jun 6, 2024

I got it to work on Expo with the latest version with a plugin. Here's how:

  1. Create a new folder in the root of your project named plugins
  2. Create a file inside the newly created folder named withPodfile.js
const { withDangerousMod, withPlugins } = require('@expo/config-plugins');

const fs = require('fs');
const path = require('path');

async function readFile(path) {
  return fs.promises.readFile(path, 'utf8');
}

async function saveFile(path, content) {
  return fs.promises.writeFile(path, content, 'utf8');
}

module.exports = (config) =>
  withPlugins(config, [
    (config) => {
      return withDangerousMod(config, [
        'iOS',
        async (config) => {
          const file = path.join(config.modRequest.platformProjectRoot, 'Podfile');

          /*
           * You need to remove the line before adding it.
           * If you don't do this and you run `expo prebuild` in a dirt project
           * your file will have the same line added twice
           */
          const contents = (await readFile(file)).replace(
            /pod 'IQKeyboardManagerSwift', :git => 'https:\/\/github.com\/douglasjunior\/IQKeyboardManager.git', :branch => 'react-native-keyboard-manager'\n\n/g,
            '',
          );
          /*
           * Now re-adds the content
           */
          await saveFile(
            file,
            `pod 'IQKeyboardManagerSwift', :git => 'https://github.com/douglasjunior/IQKeyboardManager.git', :branch => 'react-native-keyboard-manager'\n\n${contents}`,
          );
          return config;
        },
      ]);
    },
  ]);
  1. Add your new plugin file to app.json
{
  "expo": {
    "name": "bidaction",
    ...
    "plugins": [
      ...
      "./plugins/withPodfile"
    ],
    ...
  }
}
  1. Rebuild the app with npx expo prebuild --clean

@douglasjunior
Copy link
Owner

douglasjunior commented Jun 6, 2024

Nice @samuelbeaulieu, I'm going to link your comment on README.

@lodev09

This comment was marked as off-topic.

@douglasjunior

This comment was marked as off-topic.

@lodev09

This comment was marked as off-topic.

@Albert-Gao
Copy link

Albert-Gao commented Jun 8, 2024

I got it to work on Expo with the latest version with a plugin. Here's how:

  1. Create a new folder in the root of your project named plugins
  2. Create a file inside the newly created folder named withPodfile.js

Thanks so much for writing this plugin, however, I found it is only working after I updating the "iOS" to "ios", according to the latest of Expo doc (https://docs.expo.dev/config-plugins/plugins-and-mods/#experimental-functionality)

so this line:

 return withDangerousMod(config, [
        'iOS',

has to be

 return withDangerousMod(config, [
        'ios',

@Piton077
Copy link

Hi just act on Samuel advice but it still not working. I implemented the plugin and yet the accessory top bar with done button etc doesnt appear.
When I run expo build command, it raises the following. is it mandatory to run that command ?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants