How to Add a "Target" to a pod file? (such as HockeyApp) - react-native

I'm reading React Native Cookbook by Crysfel Villa, Stan Bershadskiy
I'm at a chapter on using hockeyapp and not sure how to setup the podfile. These are the directions:
How to do it...
First we need to install the react-native-hockeyapp
module in our application. Open the Terminal, go to your application's
root project directory and enter the following command: $ npm install
react-native-hockeyapp --save Go into your ios/ directory and
initialize your Podfile: $ pod init Open your Podfile and add pod
"HockeySDK" to your target. Back in the Terminal, install the Podfile:
$ pod install
I am not 100% sure about "add pod HockeySDK to your target"
My podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp
target 'MyApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp-tvOS' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp-tvOS
target 'MyApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Any idea on how to modify the pod file correctly here?

If you want to include HockeySDK module in MyApp target (which is the app that you are builidng) you just need to add pod 'HockeySDK' line like this:
target 'MyApp' do
(...)
pod 'HokeySDK'
(...)
end
Then after running pod install open .xcworkspace file instead of .xcproj. You can find more information in official CocoaPods guide.

Related

React-Native (0.64.1) & Notification Extension

I am trying to integrate a Notification Extension in my react-native app using the Batch SDK. However I have the following error:
‘sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Here is my pod file:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
abstract_target 'BrandName' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
target 'BrandNameApp' do
#Production-specific pods
target 'BrandNameAppTests' do
inherit! :complete
# Pods for testing
end
end
target 'BrandNameAppDevelopment' do
#Development-specific pods
end
target 'BrandNameAppStage' do
#Stage-specific pods
end
target 'RichNotificationsExtension' do
#Extension-specific pods
pod 'BatchExtension-ObjC'
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
If I try to put my target 'RichNotificationsExtension', else where in my podfile, the module will not be found by the extension file.
I have try to set the "Require Only App-extension-safe API" to "NO" as I have seen in some answers but Xcode won't allow me to build anymore and if I force it in my pod file, the module will not be found either.
Does anyone have a functioning podfile in react-native working with an extension ?
Thanks in advance

React Native 0.63 generated podfile [!] The Podfile does not contain any dependencies

I have built an app which is working on android fine. I have now got a MacBook Pro (M1) and am trying to build my RN app to iOS.
I ran sudo gem install cocoapods
I installed the packages at the root using npm install
cd ios
pod init
here is my podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'caffeind' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for caffeind
target 'caffeindTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'caffeind-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for caffeind-tvOS
target 'caffeind-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
as you can see there are no pods where I expected more, so when I run pod install i receive the message and rightly so...
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
[!] The Podfile does not contain any dependencies.
however when I then go to build in my Xcode using caffeind.xcworkspace file, I receive the error
'React/RCTBridgeDelegate.h' file not found
there is some helpful advice here - https://github.com/facebook/react-native/issues/25838 but...
I cannot add React to the schemes and I do not see it in my Libraries folder in my project navigator. As the above error seems to be linked to the cocoapods dependency, I believe these issues are linked and whenever I try to manually add React pods to the podfiles there is always another dependency or pod that it needs.
This is my xCode directory
caffeind
caffeind
Libraries - empty
Products
Frameworks
Resources
Pods
pods
-etc
versions:
React Native - 0.63.2
React Native cli - 4.14.0
Ruby - 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
Cocoapods - 1.10.1
Xcode - 12.4
MacBook Pro - Big Sur - 11.2.3 - M1

Unable to find a specification for `React-Core`

trying to install "react-native-camera" to my project.
I'm following those steps: https://github.com/react-native-camera/react-native-camera/blob/master/docs/installation.md#requirements
But at "Additional installation steps" when I use "pod install" It returns;
[!] Unable to find a specification for `React-Core` depended upon by `react-native-camera/BarcodeDetectorMLKit`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
My Podfile below:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'blabla' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
# Pods for blabla
target 'blablaTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'blabla-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for blabla-tvOS
target 'blabla-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
React native version is 62.0.
React-native-camera version is 3.40.0
What could be problem?
add manually to your Podfile the pod missing:
pod 'React-Core', :path => '../node_modules/react-native/React'

React missing in Product (Edit Scheme) after react-native upgrad

After upgrade to latest react-native Product -> Edit scheme is missing in Xcode.
My Podfile is like below
#Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
pod 'Fabric'
pod 'Crashlytics'
target 'Helloworld' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Helloworld
target 'Helloworld-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'HelloworldTests' do
inherit! :search_paths
# Pods for testing
end
end

Getting error - No Such Module 'SquarePointOfSaleSDK' on the import statement

I have followed the cocoapods instructions faithfully: Podfile is:
# Uncomment the next line to define a global platform for your project
# platform :ios '9.0'
target 'SquareTesting' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for SquareTesting
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firestore', :podspec => 'https://storage.googleapis.com/firebase-preview-drop/ios/firestore/0.7.0/Firestore.podspec.json'
pod 'SquarePointOfSaleSDK'
end
I performed pod update and pod install --repo-update also, and the message: Using SquarePointOfSaleSDK (3.3.1) appeared in the verbiage.
The "SquarePointOfSaleSDK" pod appears in the list of installed pods in the file navigator.
Any suggestions would be much appreciated!
After struggling one whole day, I gave up and use
#import <SquarePointOfSaleSDK.h>
instead of
#import SquarePointOfSaleSDK;
It works, however I want to know what is the best way to fix this issue.