M1 Mac, XCode 13.2.1 and banked-ios-sdk - throws "DYLD 1 Library missing" / Sentry error - cocoapods

When trying to install the 'banked' ios SDK (using these instructions:
https://developer.banked.com/docs/banked-ios-sdk )
I am getting an app crash.
Information suggests i need to install Sentry - which i have tried, but to no avail.
Any help greatly appreciated
M1 Mac (Montery V12.1)
XCode 13.2.1
banked-ios-sdk
When i run pod install it throws the error:
"DYLD 1 Library missing" / Sentry error
My podfile:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
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.0'
target 'APP_NAME' do
pod 'Banked'
# Enables Expo modules
use_expo_modules!
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
config = use_native_modules!
# Enables ReactNative
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
# Enables Testing
target 'systemSpendAppReactNativeOnM1Tests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
#
# use_flipper!()
use_flipper!({ 'Flipper' => '0.91.1', 'Flipper-Folly' => '~> 2.6', 'Flipper-RSocket' => '~> 1.4' })
# Enables Silicon/M1 Mac's
post_install do |installer|
react_native_post_install(installer)
installer.aggregate_targets.each do |aggregate_target|
aggregate_target.user_project.native_targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
end
end
aggregate_target.user_project.save
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
end
end
The error i am receiving, app loads then crashes/closes after splash screen is:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: DYLD 1 Library missing
Library not loaded: #rpath/Sentry.framework/Sentry
Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/2B5AA6E3-D684-4EE7-B491-8C2CA7F10B21/data/Containers/Bundle/Application/668F833C-424C-4EBC-B3FF-C42E173138D2/APP_NAME.app/Frameworks/Banked.framework/Banked
Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/Sentry.framework/Sentry' (no such file), '/usr/lib/swift/Sentry.framework/Sentry' (no such file), '/Users/USER_NAME/Library/Developer/CoreSimulator/Devices/2B5AA6E3-D684-4EE7-B491-8C2CA7F10B21/data/Containers/Bundle/Application/668F833C-424C-4EBC-B3FF-C42E173138D2/systemSpendAppReactNativeOnM1.app/Frameworks/Sentry.framework/Sentry' (no such file), '/Users/USER_NAME/Library/Developer/CoreSimulator/Devices/2B5AA6E3-D684-4EE7-B491-8C2CA7F10B21/data/Containers/Bundle/Application/668F833C-424C-4EBC-B3FF-C42E1731
(terminated at launch; ignore backtrace)

Related

Module 'fluttertoast' not found Xcode

I have integrated fluttertoast in my app, I can't run it on real device, it shows Module 'fluttertoast' not found. I searched all over the internet, but nothing helped me. I can run it only on virtual device. How can I solve it ?.
This is my PodFile
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
]
end
end
end

React-Native Expo - Folly Issues in IOS

When building an Exjected Expo33 project in XCode we are getting the following: (Works fine in Android).
Undefined symbols for architecture x86_64:
"folly::dynamic::getDefault(folly::dynamic const&, folly::dynamic&&) const &", referenced from:
facebook::react::JSCExecutor::initOnJSVMThread() in libReact.a(JSCExecutor.o)
"folly::dynamic::at(folly::dynamic const&) const &", referenced from:
folly::dynamic::operator[](folly::dynamic const&) const & in libReact.a(Value.o)
"folly::dynamic::operator[](folly::dynamic const&) &", referenced from:
facebook::react::ModuleRegistry::getConfig(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libReact.a(ModuleRegistry.o)
facebook::react::CxxNativeModule::invoke(unsigned int, folly::dynamic&&, int) in libReact.a(CxxNativeModule.o)
facebook::react::parseMethodCalls(folly::dynamic&&) in libReact.a(MethodCall.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Usually, this points to a problem Podspec file but the PodSpec seems solid compared to the default (Below for reference).
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
target 'project-name' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/2.11.0",
:subspecs => [
"Core"
],
:inhibit_warnings => true
# Install unimodules
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
use_unimodules!
pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
pod 'rn-fetch-blob',
:path => '../node_modules/rn-fetch-blob'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
post_install do |installer|
installer.pods_project.main_group.tab_width = '2';
installer.pods_project.main_group.indent_width = '2';
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
# It removes React & Yoga from the Pods project, as it is already included in the main project.
targets_to_ignore = %w(React yoga)
if targets_to_ignore.include? target.name
target.remove_from_project
end
end
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
if pod_name == 'ExpoKit'
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# Enable Google Maps support
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS=1'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS_UTILS=1'
end
end
if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? pod_name
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
# Can't specify this in the React podspec because we need to use those podspecs for detached
# projects which don't reference ExponentCPP.
if pod_name.start_with?('React')
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
end
end
# Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
# RCT_ENABLE_PACKAGER_CONNECTION disabled
next unless pod_name == 'React'
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
end
end
end
end

Removing a static lib from the build phase for a particular target in a Podfile

I have a target called FooWatchKitExtension. I would like to prevent Cocoapods from adding libPods-FooWatchKitExtension.a to the linked libraries for this particular target.
This is what I've currently specified for that target:
target 'FooWatchKitExtension' do
firebase
end
This is what I have in my post install script:
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'Pods-FooWatchKitExtension'
p target.name
end
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.3'
end
end
installer.pods_project.build_configurations.each do |config|
if config.name == 'Release'
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Owholemodule'
else
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
end
end
end
Is this possible within a Podfile? If so, how?

cocoapods 0.38.2 post_install hook can't update my preprocessor macros?

I added a configuration (adhoc) for my Xcode Project(assume the name is Flurry) and I want to add a GCC_PREPROCESSOR_DEFINITIONS to that configuration like DEBUG.I did that by pro_install hook.I added the following code :
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == "Adhoc"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC=1"
end
end
end
end
Because I use the cocoapods 0.38.2,So I need to use pods_project instead of project.
The Code works well on the targets that generated by cocoapods,like the AFNetworking, Pods-Flurry and all the third-party frameworks. But it didn't do any change to my project ,Flurry.So the preprocessor marco ADHOC didn't not working when I use the following code:
#ifdef ADHOC
NSLog(#"do something here");
#endif
So , How can I add a preprocessor marco the my adhoc configuration by using post_install hook.
BTW,the code below work on older version,like 0.37.1:
There is only one difference pods_project and project
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == "Adhoc"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC=1"
end
end
end
end

An error occurred while processing the pre-install hook of the Podfile

I met an error when I run pod install.
[!] An error occurred while processing the pre-install hook of the Podfile.
undefined method `pods' for #<Pod::Installer:0x007f9f93a66b90>
/Users/XieYunjia/warmupApp/Podfile:49:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.38.0/lib/cocoapods-core/podfile.rb:153:in `call'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.38.0/lib/cocoapods-core/podfile.rb:153:in `pre_install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:731:in `run_podfile_pre_install_hook'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:719:in `block in run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/user_interface.rb:140:in `message'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:718:in `run_podfile_pre_install_hooks'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:142:in `block in download_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/user_interface.rb:59:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:139:in `download_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/installer.rb:104:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/command/project.rb:101:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/lib/cocoapods/command.rb:48:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.0/bin/pod:44:in `<top (required)>'
/usr/bin/pod:23:in `load'
/usr/bin/pod:23:in `<main>'
This is the content of my Podfile.
platform :ios, "7.0"
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => '2.5.4'
pod 'MagicalRecord', :git => 'https://github.com/magicalpanda/MagicalRecord.git', :tag => 'v2.3.0-beta.5',:inhibit_warnings => true
pod 'ReactiveCocoa', '~> 2.4.7'
......
pod 'LTNavigationBar', '~> 2.0.1'
pod 'TSMessages' ,:head
# DEBUG
pod 'SocketRocket', '~> 0.2.0' ,:inhibit_warnings => true, :configurations => ['Debug']
pod 'PonyDebugger', '~> 0.4.3' ,:inhibit_warnings => true, :configurations => ['Debug']
pod 'Reveal-iOS-SDK', :configurations => ['Debug']
target :warmupTests, :exclusive => true do
pod 'Kiwi'
end
#remove all unsupported localization files
pre_install do |installer|
supported_locales = ['base' , 'zh-hans', 'en' , 'english']
installer.pods.each do |pod|
%x[ find "#{pod.root}" -name '*.lproj' ].split.each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
end
If I removed the last few lines showing below, this error would disappear.
#remove all unsupported localization files
pre_install do |installer|
supported_locales = ['base' , 'zh-hans', 'en' , 'english']
installer.pods.each do |pod|
%x[ find "#{pod.root}" -name '*.lproj' ].split.each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
end
What causes this error, and how can I fix it?
Sorry for my poor English.
You get this error message on CocoaPods 0.38+, just change installer.project to installer.pods_project will resolve it.
See https://github.com/CocoaPods/CocoaPods/issues/3918 for more details:
Yep, this is due to changes in the hooks API which you're using in your Podfile, see http://blog.cocoapods.org/CocoaPods-0.38/ for more information.
Cocoapods made a change to installer recently. You'll want to do something like this:
pre_install do |installer|
supported_locales = ['base', 'zh-hans', 'en', 'english']
Dir.glob(File.join(installer.sandbox.pod_dir('FormatterKit'), '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
Try something like this for backwards compatibility
pre_install do |installer_or_rep|
# backwards compatibility info http://blog.cocoapods.org/CocoaPods-0.38/
supported_locales = ['base' , 'zh-hans', 'en' , 'english']
if installer_or_rep.respond_to?(:installer)
# pre 0.38.0
installer_or_rep.pods.each do |pod|
delete_unsupported_locales(pod.root, supported_locales)
end
else
# post 0.38.0
delete_unsupported_locales(installer_or_rep.sandbox.root, supported_locales)
end
end
def delete_unsupported_locales(root, supported_locales)
Dir.glob(File.join(root, '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
Updated script working on pod v1.3.1 (as of 4/10/2017)
platform :ios, '9.0'
target 'MyApp-iOS' do
use_frameworks!
# Pods for MyApp-iOS
# Remove unused languages from Pods
pre_install do |installer|
supported_locales = ['base', 'en', 'english']
delete_unsupported_locales(installer.sandbox.root, supported_locales)
end
end
def delete_unsupported_locales(root, supported_locales)
Dir.glob(File.join(root, '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end

Resources