facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.28k stars 24.35k forks source link

Issue to upload in App Store - ITMS-90338 #37721

Closed richardReitz closed 1 year ago

richardReitz commented 1 year ago

Description

I'm facing an issue when trying to deliver to App Store Connect. When I load the app, I get this email from Apple:

ITMS-90338: Non-public API usage - The app references non-public selectors in MyApp: _isKeyDown, _modifiedInput, _modifierFlags. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/

Reading other issues with similar errors, I downgraded the 'Minimal Deployments' and added the find_and_replace code to the Podfile, but it didn't work for me.

In Android the upload to store works fine. I'm using Xcode 14.3.

React Native Version

0.71.7

Output of npx react-native info

System: OS: macOS 12.6.4 CPU: (4) x64 Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz Memory: 2.91 GB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node Yarn: 1.22.19 - ~/Documents/client-mobile-v2/node_modules/.bin/yarn npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm Watchman: 2023.04.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.12.1 - /Users/developer/.rvm/gems/ruby-3.2.2/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9862592 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.7 => 0.71.7 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  1. Archive App or build in App Center.
  2. Try to delivery in App Store Connect.
  3. Receive an email from apple with one more issue.

Snack, code example, screenshot, or link to a repository

My Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
prepare_react_native_project!

$RNMapboxMapsVersion = '~> 10.11.1'
$RNMapboxMapsImpl = 'mapbox'

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
# flipper_config = ENV['nNO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

abstract_target 'appCommonPods' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_frameworks! :linkage => :static

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  $RNFirebaseAsStaticFramework = true

  pod 'react-native-branch', path: '../node_modules/react-native-branch'
  pod 'RNSha256', :path => '../node_modules/react-native-sha256'
  pod 'RNFS', :path => '../node_modules/react-native-fs'
  pod 'MapboxMaps', '10.11.1'
  pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'react-native-fbsdk-next', :path => '../node_modules/react-native-fbsdk-next'
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)

    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

    installer.pod_targets.each do |pod|
        if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
          def pod.build_type;
            Pod::BuildType.static_library # I assume you use CocoaPods >= 1.9
        end
      end
    end
  end

  target 'app' do
    #Production-specific pods
    target 'appTests' do
      inherit! :complete
      # Pods for testing
    end
  end
  target 'appDevelopment' do
    #Development-specific pods
  end

  def find_and_replace(dir, findstr, replacestr)
    Dir[dir].each do |name|
        text = File.read(name)
        replace = text.gsub(findstr,replacestr)
        if text != replace
            puts "Fix: " + name
            File.open(name, "w") { |file| file.puts replace }
            STDOUT.flush
        end
    end
    Dir[dir + '*/'].each(&method(:find_and_replace))
  end

  post_install do |installer|
    $RNMapboxMaps.post_install(installer)
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
      end
    end

    find_and_replace("./node_modules/react-native/React/Base/RCTKeyCommands.m",
      "_modifierFlags",
      "_modifierEventFlags")
    find_and_replace("./node_modules/react-native/React/Base/RCTKeyCommands.m",
      "_modifiedInput",
      "_modifiedEventInput")
    find_and_replace("./node_modules/react-native/React/Base/RCTKeyCommands.m",
      "_isKeyDown",
      "_isKeyEventDown")

  end

end

target 'OneSignalNotificationServiceExtension' do
  use_frameworks! :linkage => :static
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end

target 'OneSignalNotificationServiceExtensionDev' do
  use_frameworks! :linkage => :static
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end
github-actions[bot] commented 1 year ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.71.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
blakef commented 1 year ago

We've seen this issue in the past. You'll need to set your build configuration to Release to avoid bundling the development tooling code that's using these API.

mhazizk commented 1 year ago

i've encountered similar issue after uploading my app to be tested in TestFlight

however, changing build configuration to Release still giving me same response from Apple Developer

strangeliu commented 1 year ago

changing build configuration to Release not work for me

mhazizk commented 1 year ago

after countless of trial, ive succesfully submitted to app store connect Basically what I'm doing is changing these Build Profile and Archive scheme to Release Hope this helps anyone

image
github-actions[bot] commented 1 year ago

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because the author hasn't provided the requested feedback after 7 days.