Can't install MSAL library using swift and Native Modules.

Anton Nikonov 1 Reputation point
2022-11-17T08:10:26.863+00:00

I'm trying to implement a native module using swift in a react native app and I'm getting errors when I run the app. Tell me what I'm doing wrong, because I'm not a native developer.

Error:
Cannot code sign because the target does not have an Info.plist file and one is not being generated automatically. Apply an Info.plist file to the target using the INFOPLIST_FILE build setting or generate one automatically by setting the GENERATE_INFOPLIST_FILE build setting to YES (recommended).

I tried to add GENERATE_INFOPLIST_FILE - YES to User-Defined but it gave me an error.

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'

install! 'cocoapods', :deterministic_uuids => false

production = ENV["PRODUCTION"] == "1"

target 'mobexo' do

use_frameworks!

pod 'MSAL'

config = use_native_modules!

Flags change depending on the env values.

flags = get_default_flags()

$static_framework = ['Flipper-Boost-iOSX', 'Flipper-RSocket', 'glog', 'Yoga', 'YogaKit', 'React-logger', 'Flipper-Fmt', 'RCT-Folly', 'Flipper-Folly', 'React-jsi', 'FlipperKit', 'Flipper', 'Flipper-Glog', 'Flipper-PeerTalk', 'React-cxxreact', 'React-jsiexecutor', 'React-Core', 'React-RCTText', 'RCTTypeSafety', 'ReactCommon', 'React-Codegen', 'React-RCTVibration', 'React-RCTSettings', 'React-RCTNetwork', 'React-RCTLinking', 'React-RCTAnimation', 'React-RCTBlob', 'React-RCTImage', 'React-CoreModules']

pre_install do |installer|

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

installer.pod_targets.each do |pod|  

    if $static_framework.include?(pod.name)  

      def pod.build_type;  

        Pod::BuildType.static_library  

      end  

    end  

  end  

end

use_react_native!(

:path => config[:reactNativePath],  

# to enable hermes on iOS, change `false` to `true` and then install pods  

:production => production,  

:hermes_enabled => flags[:hermes_enabled],  

:fabric_enabled => flags[:fabric_enabled],  

#:flipper_configuration => FlipperConfiguration.enabled,  

:flipper_configuration => FlipperConfiguration.enabled(["Release", "Debug"], { 'Flipper' => '0.127.0' }),  

# An absolute path to your application root.  

:app_path => "#{Pod::Config.instance.installation_root}/.."  

)

target 'mobexoTests' do

inherit! :complete  

# Pods for testing  

end

post_install do |installer|

react_native_post_install(installer)  

__apply_Xcode_12_5_M1_post_install_workaround(installer)  

end

end

261325-microsoftteams-image.png

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,681 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 27,941 Reputation points Microsoft Employee
    2022-11-18T10:34:44.113+00:00

    Hi @Anton Nikonov ,

    Thanks for reaching out.

    Did you tried to add the Info.plist path to: Pods -> Build Settings -> Packaging -> Info.plist File

    Reference for similar issue: https://github.com/CocoaPods/CocoaPods/issues/11402 where upgrading the Cocoapods version helps to resolve the issue.

    Hope this will help.

    Thanks,
    Shweta

    0 comments No comments