Creating a new cocoapods pod - operating-system

I'm trying to create my first pod, and, as per the recommendation on the website, am doing so at the command line with pod lib create <mylib>. The trouble is lib create assumes I want to create an iOS library, when in fact I'm developing for OS X. I've grep'ed my way through the cocoapod files on my computer looking for the template on which the generated project is based, but have come up empty-handed. Does anyone know how I might fiddle with these settings, wherever they are, to get the configuration I'm after?

If you already have your library created and just want to create a sample podspec you should use:
pod spec create
Instead. You can also pass this a URL to set that as the source automatically. See
pod spec create --help
For more info.

Related

Unity-iOS; Is there a way to modify Pod file dependencies after export automatically?

sometimes pod file is getting old versions of my third parties so i am wondering if there is any way of modifying podfile and adding desired dependency versions(eg; firebase 7.0.0) automatically after ios export? I am also wondering why pod file is getting wrong versions aswell.
With Firebase, this is normally managed via the External Dependency Manager. This is configured using xml files. In the case of Firebase, this is inside the Firebase package in Firebase/Editor/AppDependencies.xml.
You may have other xml files in your project that are specifying conflicting dependencies perhaps from an old version of Firebase?

How to embed third party framework on ionic capacitor custom plugin?

I am developing an Ionic Capacitor plugin which imports 2 iOs .framework files and a .bundle that refers to one of this .framework files. The thing is that no matter how I link/embed and point/copy this files on the plugin project, xcode claims, on the app project, that it cant find the module in the swift file.
I already tried to add the files to the project, used the "Embedded binaries" option, linked libraries, allow non-modular includes (on build options menu), add the files to the headers (on build phases), and so on....
The line that xcode point the error is:
import OneFramework
And xcode claims:
No such module 'OneFramework'
I was expecting that when I add the plugin to my app project via npm, and later running a "$ rm -rf ios && ionic capacitor run ios" to run the app, xcode find all the modules of the plugin that I am trying to do.
I found the solution. To achieve this the first thing to know is that when you do npx #capacitor/cli plugin:generate what the CLI do for you is the generation of a cocoa pod. The root of this pod is the generated folder itself.
With that in mind, the next thing to do is to learn how to make pods, but i'll sumarize the principal aspects that led me to the success.
-First of all you open the *.xcworkspace. Followed by that, click on the "Add Files to Pod..." option and add your files. Please ensure that the "Copy files if needed" option is marked. Please refer to the picture below.
-Now its nice to create a folder for your .framework and another for the .bundle (if there are any) files. Do this by right clicking the Pods project and select the option "New group". Select a name like that is different from the pattern of xcode, it is nice to know that this folders are created by you.
-If you done this right, the frameworks you recently added to the project will appear on the pods project like this:
-Now, for your swift implementation find your files, drag your .frameworks that are on the pods project for the "Frameworks, Libraries and Embedded content" of the plugin project. The result will be something like this:
-Ok, files included and linked. Now we should let our cocoa pod know about this and declare this files. The file "YourAwesomePlugin.podspec" (located at the root of the plugin project) is the main entrance of the pod. In this file you will declare which files (.frameworks, .bundle, etc) belong to your pod and consequently will belong to your plugin when you npm install it. To declare this you'll need three directives:
s.vendored_frameworks = 'ios/Pods/YourFrameworkFolder/**'
s.resource = 'ios/Pods/YourResourceFolder/YourBundle.bundle'
s.xcconfig = {'ENABLE_BITCODE' => 'NO'} #This is mandatory on my case, but you need to evaluate if this options applies to your plugin.
-Now we hit play on the plugin project. To test on your app if the plugin is ok, you need to add the path of the root of the plugin project on the podfile of the pods project of the APP project. Like this:
-To install it you can go on Yourproject/ios/App and run pod install.
Please note that:
To declare the existence of your recently created plugin you you need to do some declarations as well, but this part is easy and already documented on capacitor/plugin docs.
The installation method via pod install that I suggested is for testing. It would be nice if you pack your plugin using npm and npm install it like all other plugins.
I dont have much knowledge on cocoapods like I wish, but this works and I think that is a clean solution. If not, please let me know.
If this answer is useful for you, please thumbs it up, it is a week of research and trying that I am sharing, along the time to write it all down.

Cocoapods not including additional files

I have a cocoapod I've built which makes use of Apples new coreml library. As such it has several .mlmodel files that it makes use of to do data categorization etc.
The issue I am facing is that when I add the pod to another project and run a pod install it installs the pod as required, but the .mlmodel files are all missing - meaning the class files they generate are not found, so as such if I try to do a build, it fails. I know that .mlmodel files are a bit special as they are static files that generate a class on compilation, but I'm not sure how to force them to be included as files in the pod.
I have tried using smaller models in case it was a file size issue, ala the 100MB limit that git has for example, but this did not help. I'm not sure how to deal with it, as a static image file, for example, works fine.
Currently, I just manually drag the .mlmodel files into the pod folder after I've done an install, but this obviously is not a feasible method for build servers etc.
Use preserve_paths in the podspec for the .mlmodel files.

PNChart-swift not working

I wanna use some charts in my swift project, actually I was using PNChart before, but now I need to move on to PNChart-swift.
https://github.com/kevinzhow/PNChart-Swift
as the readme saids I added some lines in Podfile, and I
pod install
then I get "no such module PNChart-swift"
I think Pod is cloning the wrong Codes from the PNChart-swift repository.
Is there any way I can clone the codes and use as the library without using Pod?
Thank you.
For manual installation you could just download the repo as zipfile and than drag the .xcodeproj file into your project.
This will create the required reference so that you can use it.
You may also need to add it as embedded framework in your project settings.

Tumblr integration in iPhone SDK

Using https://github.com/tumblr/TMTumblrSDK link, i am trying to integrate tumbler sdk and compile the Photosharing sample project under the Example folder. But i am getting the following error message:
diff: /../Podfile.lock: No such file or directory
I am not able to understand the pod file concept. Can anyone please explain me the proper steps that need to be followed to integrate this sdk in iOS app.
The targets in your xcode projects have a build phase to perform a lock file. But it seems like your xcode projects configurations are not referencing the user defined settings configured in Pods/Pods-libPods.xcconfig.
It looks like you are trying to link a Pod with specific targets in multiple xcodeprojs. If my assumption is correct, you are using the target attribute incorrectly. The target attribute creates a new static library within the Pods project that includes the Pods you configured within that target.
The default target for the Pods xcodeproj is libPods which generates the libPods.a static library. This is generated if you do not specify a target. So if you don't care about generating multiple static libaries in the Pods xcodeproj, don't bother defining a target and use the link_with attribute to link the default libPods target (static library) to the targets in your xcodeprojs.
check this link for further reading here