Cocoapods not installed, build ios in gitlab CI failed - ios

I have a new flutter app. When i build it locally everything works. But I pushed it to the repository and it didn't pass the pipeline to build iOS app. The error:
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
CocoaPods not installed or not in valid state.
Am I missing something? I saw similar posts and everyone said gem install cocoapods, but how can I install it if everything works fine locally and the problem is only in the repository build?

Related

Cocoapods Acknowledgements.plist file not found when using Xcode Cloud for CI/CD

In My Podfile, I have a post_install hook that has the following line of code:
FileUtils.cp_r('Pods/Target Support Files/Pods-MyApp/Pods-MyApp-Acknowledgements.plist', 'MyApp/SupportingFiles/Settings.bundle/Acknowledgements.plist', :remove_destination => true)
Now, this has worked for a very long time for me, however, I recently started using Xcode Cloud for some build automation, and when running this code I had the following error in xcode cloud:
No such file or directory # rb_file_s_stat - Pods/Target Support Files/Pods-MyApp/Pods-MyApp-Acknowledgements.plist
Not sure if this has to do with Xcode Cloud or something else entirely.
Cocoapods version 1.11.3 is used on my device, and same version was used by Xcode Cloud.
only difference I can tell is that Xcode cloud is using Ventura - my machine is still using Monterey.
anyone have any ideas on how to fix, i would appreciate it.

Xcode build with Google UMP SDK fails with 'framework not found'

We make middleware using Cordova and AdMob to show ads. Cordova generates an Xcode project for us. However the resulting Xcode projects now fail to build with the error ld: framework not found UserMessagingPlatform.xcframework.
This appears to be caused by the Google UMP SDK updating to version 1.3.0, which notes "Updated the SDK from a .framework to a .xcframework." I've contacted AdMob support, and they claim the build works for them and haven't provided any useful help.
I have no idea why our builds now fail and I'm at a loss as to what to do about it. Here is a sample Xcode project: https://www.dropbox.com/s/y1ly2c3yi45rop6/TestBuild.ios.project.zip?dl=0
Can anyone identify what has gone wrong with this Xcode project causing it to fail to build, and identify a workaround?
The Issue
The issue appears to be that a framework/dependency is not added to the Xcode project, so it doesn't have the code necessary to compile the application. AdMob relies on that UserMessagingPlatform thing to work, and without the Mobile Ads SDK being present in your codebase, UserMessagingPlatform is missing and your application is essentially asking for code that isn't there. To resolve this, you have to tell cocoapods (a dependency manager, think npm but for Swift/Objective-C) to locate and add the missing code to your project.
First, install cocoapods if you haven't already. I used Homebrew to do this, as it seems to be the only method that worked without headache. Many people already have Homebrew, but if you don't, install that first, then run:
brew install cocoapods
Next, go into your project directory using the Terminal. Once you're in the directory, run:
pod install --repo-update
Reopen your project in Xcode, and it should compile successfully now.
Step by step resolution:
Skip any steps that aren't necessary for your environment.
Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install cocoapods: brew install cocoapods
Open a terminal, navigate to your project directory: cd /path/to/your/project
Update dependencies: pod install --repo-update
Disclaimer: I'm not a Swift or Objective-C developer, and my experience with Apple/Xcode is limited. I also am unfamiliar with "cocoapods" and AdMob. I just downloaded the sample code and worked through the issue until I got it to compile successfully.
Are you using Cocoapods for your XCode project?
This stackoverflow answer suggest updating cocoapods
Try updating cocoapods:
sudo gem install cocoapods
Cocoapods changelog contains fixes for XCFrameworks
.xcframework files can only be used on CocoaPods 1.10.0 or newer, in your sample app you were using 1.8.4.
Update CocoaPods to latest and run pod install again.

libPhonenumber (from Google) on iOS in a Kotlin Native project

I've been struggling to solve a problem.
I'm building a cross platform app (iOS and Android) using Kotlin Multiplatform (KMP) where I need a library from Google (https://github.com/google/libphonenumber).
For Android, I can point to a Maven repo (https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.12.6/).
For iOS, I can use a ObjC port of libPhonenumber via Cocoapods.(https://cocoapods.org/pods/libPhoneNumber-ios).
But, I can't use Kotlin's (cocoapod plugin) to properly recognize the Pod. The plugin appears to fail to build.
Here's the details of my setup:
Xcode v11.5
IntelliJ IDEA v2020.1.2
Cocoapods v1.9.1
Gradle 6.0.1
Sample repo (https://github.com/touchlab/kotlin-native)
NOTE: Within the repo, I'm using ./samples/cocoapods
modify ./samples/cocoapods/kotlin-library/build.gradle.kts
commented out AFNetworking, remove AFNetworking pod
pod("AFNetworking", "~> 3.2.0")
add a new pod
pod("libPhoneNumber-iOS")
modify ./samples/cocoapods/kotlin-library/gradle.properties
change this line:
kotlin.native.home=../../../dist
to this:
#kotlin.native.home=../../../dist
in Terminal in this folder: ./samples/cocoapods/kotlin-library/
./gradlew podspec
This creates a podspec file (libPhoneNumber-iOS.def) in ./samples/cocoapods/kotlin-library/build/cocoapods/defs/
cd from kotlin-library to ios-app folder
cd ../ios-app/
Pod install using the command:
pod install
You'll see something like:
Downloading dependencies
Installing kotlin_library (1.0)
Installing libPhoneNumber-iOS (0.9.15)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
When I build the sample 'ios-app' target: simulator in Xcode, I get the error:
fatal error: module 'libPhoneNumber' not found
I have tried other libPhoneNumber pods, such as:
libPhoneNumberSwift
LTPhoneNumberField
Both fail to build using Kotlin's cocoapods plugin, but work as a Pod without Kotlin's cocoapod plugin.
What am I missing?
This particular problem seems to be caused by the dash in the pod's name. There was already an issue reported on GitHub. For now, it's recommended to workaround this problem by re-naming the module. Changing your kotlin-library/build.gradle.kts like
pod("libPhoneNumber-iOS", moduleName = "libPhoneNumber_iOS")
should help. Please give it a try and tell here or on GH if it works.
I have obtained excellent results by adding the unchanged Javascript version of libphonenumber using JavaScriptCore in IOS. The only part of the library not available yet in Javascript is the geocoder.
I used the concept explained here: https://www.appcoda.com/javascriptcore-swift .
Performance is great and there is no porting involved. Always the latest version available.

Cocoapods cannot install Trunk

I'm trying to develop a React Native mobile app for iOS on Windows 10. Using the react native cli, I've generated a RN iOS project with the standard file structure, including a "Podfile" file with the default RN pods.
However, when I try to use "pod install" in order to add other pods of my own, I get the following error code:
[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/CocoaPods-version.yml Response: SSL peer certificate or SSH remote key was not OK
I've been googling this error but I've run into a dead end. I've tried using pod update, I've changed my cURL version, I've gone over the setup instructions for Ruby, curl, and others, and I'm at a loss. What can I do?
Note: I haven't run the app yet, and am trying to install the react-native-mapbox-gl pod first, but I can't even properly install Trunk.
cURL Version:7.70.0
CocoaPods Version: 1.9.3
You won't be able to develop for iOS on Windows – because the iOS SDK and build tools are only available on macOS. No way to legally do it without an access to an Apple computer.
You can try Expo though – it doesn't require macOS for development, but keep in mind that you will be limited to the APIs Expo provides.
As for the actual error – it seems that the CocoaPods rubygem has not been tested on Windows at all, and is likely invoking curl in a way that doesn't account for Windows's SSL certificate management system.

Problems building through bitrise; more problems building through xcode

I've somehow found myself trying to build an app through bitrise to deploy to testflight. I'm a total novice at all of this, so apologies for what probably seems stupid.
Bitrise manages to build everything but then finally refuses to deploy, citing the following in the log:
[06:06:44]: [Transporter Error Output]: description length:10500450
[06:08:55]: [Transporter Error Output]: ERROR ITMS-90725: "SDK Version Issue. This app was built with the iOS 11.4 SDK. All iOS apps submitted to the App Store must be built with the iOS 11 SDK or later, included in Xcode 9 or later. Further, starting March 2019, all iOS apps submitted to the App Store must be built with the iOS 12.1 SDK or later, included in Xcode 10.1 or later."
[06:08:55]: Transporter transfer failed.
[06:08:55]:
[06:08:55]: description length:10500450
ERROR ITMS-90725: "SDK Version Issue. This app was built with the iOS 11.4 SDK. All iOS apps submitted to the App Store must be built with the iOS 11 SDK or later, included in Xcode 9 or later. Further, starting March 2019, all iOS apps submitted to the App Store must be built with the iOS 12.1 SDK or later, included in Xcode 10.1 or later."
Fine, I think, I'll clone the repo, open up the project in xcode and thereby update the sdk version. This just seems to mean more problems... When I try to build the project within Xcode, I encounter the following error:
Users/[...]/ios/Pods/Target Support Files/Pods-x/Pods-x.debug.xxconfig: unable to open file (in target "x" in project "x")(in target 'x')
In addition to this, there are a few issues, including:
The file "Pods-x.release.xcconfig" couldn't be opened because there is no such file.
If I ignore this error, push it and build it anew on bitrise, I get the following:
Resolving dependencies of `Podfile`
[!] CocoaPods could not find compatible versions for pod "DoubleConversion":
In snapshot (Podfile.lock):
DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
In Podfile:
DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
None of your spec sources contain a spec satisfying the dependencies: `DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`), DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)`.
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.
Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
So, it's looking like there's something badly amiss with the CocoaPods installation. And indeed, when I check into the files, there is no Pods folder at all -- just Podfile and Podfile.lock. (I have no idea how it would have build fine previously without this?)
So, I try to reinstall CocoaPods into the project, by running pod install from a terminal in the iOS folder. I get that same error in the terminal: No such file or directory # rb_sysopen -- /Users/[...]DoubleConversion.podspec. pod update generates the same error. In addition, I'm told there's a new version of CocoaPods available. I install it using sudo gem install cocoapods, which generates a Pods folder with subfolders in ios, but all are empty.
As you can tell, I'm a bit baffled. If an intrinsic part of CocoaPods functionality is missing from the project files, how did it ever build previously? I'm guessing it's due to CocoaPods being installed as part of the bitrise workflow (and it is indeed there) -- but, if so, what about that is now causing it to fail during build? What is it about trying to open up the project to update the SDK used that is introducing this problem?
I'm sure all this seems a bit daft (at least I hope so). Thanks for your patience and any help would be enormously appreciated.

Resources