Giter Site home page Giter Site logo

cordova-plugin-cocoapods-support's Introduction

cordova-plugin-cocoapod-support

Are you tired of manually adding ios dependencies in Cordova apps? Me too. Android has Gradle support out of the box, but CocoaPods get no love. That is until now.

With this plugin you can define plugin or project CocoaPods dependencies right in the xml.

After adding this plugin be sure to open the .xcworkspace in XCode instead of the .xcodeproj.

Note: Dependencies defined in the config.xml take precedence of dependencies defined in plugin's.

Note: The highest value of minimum ios version will be used and use_frameworks! will be enabled if the flag is set anywhere.

How does it work?

It looks for <pod> entries the config.xml and plugin.xml, creates the Podfile, updates the necessary configs and then runs pod update for you.

How do I install it?

If you're like me and using Cordova CLI:

cordova plugin add cordova-plugin-cocoapod-support --save

or

phonegap local plugin add cordova-plugin-cocoapod-support

How do I use it?

Plugin developers, here's a sample plugin.xml.

<?xml version='1.0' encoding='UTF-8'?>
<plugin id="cordova-plugin-withpods" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
    <name>A Plugin With CocoaPods Dependencies</name>
    <description>
        A plugin demonstrating the use of CocoaPods dependencies.
    </description>
    
    <dependency id="cordova-plugin-cocoapod-support"/>

    <platform name="ios">
        <!-- optionally set minimum ios version and enable use_frameworks! -->
        <pods-config ios-min-version="9.0" use-frameworks="true">
             <!-- optionally add private spec sources -->
            <source url="[email protected]:foo/foo-specs.git"/>
            <source url="[email protected]:bar/bar-specs.git"/>
        </pods-config>
        <!-- use the latest version of a pod -->
        <pod name="LatestPod" />
        <!-- use a specific version of a pod -->
        <pod name="VersionedPod" version="1.0.0" />
        <!-- use a custom repo -->
        <pod name="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" />
        <pod name="GitPod2" git="https://github.com/blakgeek/something" branch="wood" />
        <pod name="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />
        <!-- target specific configurations, this can be combined with all other options -->
        <pod name="Foobar" configuration="debug" />
        <pod name="Foobar" configurations="release,debug" />
        <!-- add a pod dependency using a custom podspec -->
        <pod name="JSONKit" podspec="https://example.com/JSONKit.podspec" />
        <!-- add pod dependency using the spec parameter like a Cordova framework -->
        <pod name="JustLikeCordova" spec="~> 2.0.0"/>
        <pod name="JustLikeCordova" spec=":configurations => ['Debug', 'Beta']"/>
    </platform>
</plugin>

App developers, here's a sample config.xml. Entries in the config.xml will override the plugin.xml(s).
This is useful if you need to resolve conflicts between plugins or if a plugin doesn't include it's iOS dependencies.

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.blakgeek.cordova.superdopeness" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>CocoapodsDemo</name>
    <description>
        An app demonstrating the use of CocoaPods dependencies.
    </description>
    <content src="index.html" />
    <access origin="*" />
    <platform name="ios">
        <!-- set platform :ios, defaults to 7.0 -->
        <preference name="pods_ios_min_version" value="8.0"/>
        <!-- add use_frameworks! to Podfile, this also disabled bridging headers -->
        <preference name="pods_use_frameworks" value="true"/>
        <!-- use the latest version of a pod -->
        <pod name="LatestPod" />
        <!-- use a specific version of a pod -->
        <pod name="VersionedPod" version="1.0.0" />
        <!-- use a custom repo -->
        <pod name="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" />
        <pod name="GitPod2" git="https://github.com/blakgeek/something" branch="wood" />
        <pod name="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />
        <!-- target specific configurations, this can be combined with all other options -->
        <pod name="Foobar" configuration="debug" />
        <pod name="Foobar" configurations="release,debug" />
        <!-- add a pod dependency using a custom podspec -->
        <pod name="JSONKit" podspec="https://example.com/JSONKit.podspec" />
        <!-- add a pod dependency using the spec parameter like a Cordova framework -->
        <pod name="JustLikeCordova" spec="~> 2.0.0"/>
        <pod name="JustLikeCordova" spec=":configurations => ['Debug', 'Beta']"/>
        <!-- if pod uses a bundle that isn't compatible with Cocoapods 1.x -->
        <pod name="BadBundle" fix-bundle-path="Bad/Path.bundle"/>
    </platform>
</widget>

Troubleshooting

  • If you get errors like the following.
error: Resource ".../Build/Products/Debug-iphonesimulator/Lock/Auth0.bundle" not found. Run 'pod install' to update the copy resources script

Add the fix-bundle-path attribute to the pod tag with the path after the device. In this case:

<pod name="Lock" fix-bundle-path="Lock/Auth0.bundle"/>

This is caused by a bug in the later versions of CocoaPods.

or have a look at the example plugin.

Notes

  • The plugin now detects Cordova framework tags with type="podspec" so there shouldn't be anymore conflicts with the native functionality and the plugin.
  • Pod "id" was deprecated in version 1.3.0. You should use "name" instead. But don't worry "id" will continue to work. I made this change to better align with the podspec.
  • Enabling the pods_use_frameworks preference disables the bridged headers property added by CB-10072. This might cause odd behavior in some projects.

##TODO:

  • Update with examples of all of the supported pod attributes (git, podspec, path, subspec, configuration(s) )

cordova-plugin-cocoapods-support's People

Contributors

blakgeek avatar emeryguillaume avatar jasonz1987 avatar jfrumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cordova-plugin-cocoapods-support's Issues

Support for use_frameworks! :linkage => :static

Starting with CocoaPods 1.9.0, they now allow you to specify use_frameworks! :linkage => :static in your pod file so cocoa pods will generate full frameworks with statically linked libraries and module map files. I need this in order to successfully combine cordova-plugin-firebase-analytics with the latest version of Google Tag Manger pods.

It would be nice if this plugin could support this because currently I don't believe cordova.ios is able to.

Perhaps allowing both:

<pods-config use-frameworks="true">

and

<pods-config use-frameworks=":linkage => :static">

Error: Command failed: pod update

I am trying to include the pod 'Charts', '~> 2.2' in my project which is actual in Swift, using cordova plugin cordova-plugin-cocoapod-support(id="cordova-plugin-cocoapod-support" version="1.0.2"), still not able to create the iOS project without errors, I added cordova plugin cordova-plugin-add-swift-support also but facing same error. Please help me

I am seeing an error and don't know how to resolve it

My plugin looks like this:

<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-auth0" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
  <name>Auth0Native</name>
  <js-module name="Auth0Native" src="www/auth0native.js">
    <clobbers target="cordova.plugins.auth0native" />
  </js-module>
  <platform name="android">
    <config-file parent="/*" target="res/xml/config.xml">
      <feature name="Auth0Native">
        <param name="android-package" value="CordovaPluginuth0.Auth0Native" />
      </feature>
    </config-file>
    <config-file parent="/*" target="AndroidManifest.xml" />
    <source-file src="src/android/Auth0Native.java" target-dir="src/CordovaPluginAuth0/Auth0Native" />
  </platform>
  <platform name="ios">
    <pods-config ios-min-version="9.0" uses-frameworks="true" />
    <pod id="Lock" version="1.24" />
    <config-file parent="/*" target="config.xml">
      <feature name="Auth0Native">
        <param name="ios-package" value="Auth0Native" />
      </feature>
    </config-file>
    <source-file src="src/ios/Auth0Native.m" />
  </platform>
</plugin>

Then I add it to my cordova project and it correctly do the initialization:

Adding ios project...
iOS project created with [email protected]
Installing "code-push" for ios
Installing "cordova-plugin-app-name" for ios
Installing "cordova-plugin-auth0" for ios
Installing "cordova-plugin-cocoapod-support" for ios
Installing "cordova-plugin-code-push" for ios
Dependent plugin "code-push" already installed on ios.
Installing "cordova-plugin-file" for ios
Installing "cordova-plugin-compat" for ios

The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.


Installing "cordova-plugin-file-transfer" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-zip" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-dialogs" for ios
Installing "cordova-plugin-device" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-console" for ios
Plugin "cordova-plugin-device" already installed on ios. Making it top-level.
Dependent plugin "cordova-plugin-dialogs" already installed on ios.
Dependent plugin "cordova-plugin-file" already installed on ios.
Dependent plugin "cordova-plugin-file-transfer" already installed on ios.
Installing "cordova-plugin-hockeyapp" for ios
Installing "cordova-plugin-inappbrowser" for ios
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Dependent plugin "cordova-plugin-zip" already installed on ios.
Installing "ionic-plugin-keyboard" for ios
Running command: /Users/andy/Development/gormenghast/ionic2/hooks/after_prepare/010_add_platform_class.js /Users/andy/Development/gormenghast/ionic2
add to body class: platform-ios
Attempting to set app name
Setting App Name:  Text Invader
Searching for new pods
Checking cordova-plugin-app-name for pods.
Checking cordova-plugin-auth0 for pods.
cordova-plugin-auth0 requires pod: Lock
Checking cordova-plugin-code-push for pods.
Checking cordova-plugin-compat for pods.
Checking cordova-plugin-console for pods.
Checking cordova-plugin-device for pods.
Checking cordova-plugin-dialogs for pods.
Checking cordova-plugin-file for pods.
Checking cordova-plugin-file-transfer for pods.
Checking cordova-plugin-hockeyapp for pods.
Checking cordova-plugin-inappbrowser for pods.
Checking cordova-plugin-splashscreen for pods.
Checking cordova-plugin-statusbar for pods.
Checking cordova-plugin-whitelist for pods.
Checking cordova-plugin-zip for pods.
Checking ionic-plugin-keyboard for pods.
Checking config.xml for pods.
Installing pods
Sit back and relax this could take a while.
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.1.0)
Installing CocoaLumberjack (2.3.0)
Installing Lock (1.24.0)
Installing Masonry (0.6.4)
Generating Pods project

Integrating client project

[!] Please close any current Xcode sessions and use `MyApp.xcworkspace` for this project from now on.

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.

Updating ios build to use workspace.
Adding schemes

But during build I get (the first build just stops)
I see errors like this:

error: Resource "/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Products/Debug-iphonesimulator/Lock/Auth0.bundle" not found. Run 'pod install' to update the copy resources script.

Any suggestions on what to look at first?

EEXIST: file already exists, mkdir ....xcworkspace/xcshareddata

Hello (again)

I have no clue with this one, can you help ?

  • plugin release 1.2.10
  • XCode 8.2
  • macOS Sierra 10.12.2

Downloading dependencies
Installing NAOSDK (4.2.2)
Generating Pods project

Integrating client project

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

Updating ios build to use workspace.
Adding schemes
Error: EEXIST: file already exists, mkdir 'path/testapp/platforms/ios/app-name.xcworkspace/xcshareddata'

Thanks!

undefined is not a function when installing plugin

It looks like this error happens when using an old version of nodejs. It took me quite some time to realize what was going wrong, maybe you can throw a meaningful error or refuse to install on old node.js versions (I know little node, so I don't know exactly how you would implement this).

Error: TypeError: undefined is not a function
    at /Users/xxx/plugins/cordova-plugin-cocoapod-support/scripts/podify.js:182:21
    at /Users/xxx/plugins/cordova-plugin-cocoapod-support/node_modules/command-exists/lib/command-exists.js:11:13
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

My suspicion is that child_process is not present in old versions of node.

Support accented characters in application name

FWIK, either Apple Xcode or Cordova while building the xcodeproj file is re-encoding characters such as "é" with "e´".

A quick fix for my case would be replacing

var appName = configParser.name();

with :

var appName = configParser.name().replace("\u00E9", "\u0065\u0301");

Looks the same, but different :

console.log("\u00E9", "\u0065\u0301", "\u00E9" === "\u0065\u0301")
é é false

Are you aware of this issue ?

Plugin with cocoapod dependency build error

This is the plugin source

<?xml version='1.0' encoding='utf-8'?>
<plugin id="dummy-plugin" version="0.34.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
  <name>DummyPlugin</name>
  <dependency id="cordova-plugin-cocoapod-support" version="1.6.0"/>
  <dependency id="cordova-plugin-add-swift-support" version="1.7.2"/>

  <js-module name="DummyPlugin" src="www/DummyPlugin.js">
    <clobbers target="cordova.plugins.DummyPlugin" />
  </js-module>

  <platform name="ios">
    <source-file src="src/ios/DummyPlugin.swift" />
    <pods-config ios-min-version="10.0" use-frameworks="true" />
    <framework src="Zip" type="podspec" spec="1.1.0" />
  </platform>
</plugin>

In also added the <preference name="UseSwiftLanguageVersion" value="4.1" /> line in config.xml

The plugin installs correctly, the project builds correctly using xcode (after adding an additional param in the Pods project SWIFT_VERSION = 4.1)

But the project does not build using cordova build ios --device, I am receiving the following error:

ld: warning: directory not found for option '-F/Users/alexchirila/Library/Developer/Xcode/DerivedData/HelloWorld-gfigdqjpsastrsdveoablncumimx/Build/Intermediates.noindex/ArchiveIntermediates/HelloWorld/BuildProductsPath/Debug-iphoneos/Zip'
ld: framework not found Zip
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there anything I am doing wrong? Are there any workarounds?

Private pods source

Hi,
is there a way to add the source parameter to the Podfile so that I can use also private pods

The generated Podfile would then looks like this

# Podfile
platform :ios, '8.0'
use_frameworks!

source '[email protected]:foo/bar-cocoapods-specs.git'

pod 'MyKit', '~> 3.2'

cheers

lodash error

Executing script found in plugin cordova-plugin-cocoapod-support for hook "after_prepare": plugins/cordova-plugin-cocoapod-support/scripts/podify.js
Error: Cannot find module 'lodash'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/asaup/site-home/io.nuwa.live.hx.app/plugins/cordova-plugin-cocoapod-support/scripts/podify.js:3:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Private podspecs not updated

Hi,
when I add a private podspec using

        <pods-config ios-min-version="9.0" use-frameworks="true">
             <!-- optionally add private spec sources -->
            <source url="[email protected]:foo/foo-specs.git"/>
            <source url="[email protected]:bar/bar-specs.git"/>
        </pods-config>
        <!-- use the latest version of a pod -->
        <pod name="MyPod" version="3.3.0" />

The pod installation fails because the podspecs are not updated:

Sit back and relax this could take a while.
Analyzing dependencies
[!] Unable to satisfy the following requirements:

- `MyPod (= 3.3.0)` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `MyPod (= 3.3.0)`.

You have either:
 * out-of-date source repos which you can update with `pod 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.

It can be manually fixed by running pod repo update but it has to be run in the generated xcode project folder which is not convenient.

Extended ReadMe for Newbs

Hey @blakgeek ! Awesome work!

I'm having a little trouble understanding the ReadMe. I'm trying to make a CocoaPod from this git

https://github.com/Kandy-IO/kandy-phonegap

And I edited the plugin.xml config as so :

    <!-- iOS -->
    <platform name="ios">
        <pods-config ios-min-version="9.0" use-frameworks="true"/>
        <pod id="kandy-phonegap" git="https://github.com/Kandy-IO/kandy-phonegap.git" configuration="release,debug" />

And in my config.xml :

        <preference name="pods_use_frameworks" value="true"/>
        <pod id="kandy-phonegap" git="https://github.com/Kandy-IO/kandy-phonegap.git" configuration="release,debug" />

But I get this error :

Unable to find a specification for 'kandy-phonegap'.

I also see it accessible as a Pod here : https://cocoapods.org/pods/Kandy

Any advice for a daft cocoa newbie? I'd be more than happy to fork more clearer directions to the ReadMe

Not reading podspec tags in Plugins

I have cordova-plugin-firebase-analytics in my app. In it's plugin.xml file it contains:

  <podspec>
     <config>
         <source url="https://github.com/CocoaPods/Specs.git"/>
     </config>
     <pods>
           <pod name="Firebase/Analytics" spec="~> 6.1.0" />
      </pods>
   </podspec>

cocoapods-support doesn't recognize this and therefore doesn't add it to my Podfile

Can

I will get the error

Error: Pruning at selector "widget" went bad

I am using Cordova 6.3.1

Plugin won't install successfully

Running "cordova plugin add cordova-plugin-cocoapod-support" gives following error log

Fetching plugin "cordova-plugin-cocoapod-support@~1.3.0" via npm
Installing "cordova-plugin-cocoapod-support" for ios
node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v46-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v46-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v46-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v46 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v46-darwin-x64.tar.gz
In file included from ../vendor/libxml/xpath.c:476:
../vendor/libxml/trionan.c:194:1: warning: unused function 'trio_is_special_quantity' [-Wunused-function]
trio_is_special_quantity
^
../vendor/libxml/trionan.c:218:1: warning: unused function 'trio_is_negative' [-Wunused-function]
trio_is_negative
^
2 warnings generated.
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9

https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v46-darwin-x64.tar.gz file does not exist physically.

OS: macOS 10.12.3
Cordova: 6.4.0

CocoaPods Base Configuration

I'm running into a problem where CocoaPods throws the following warning/error after installing some pods (via a plugin's pod requirements):

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target '<project name>' to 'Pods/Target Support Files/Pods-<project name>/Pods-<project name>.debug.xcconfig' or include the 'Pods/Target Support Files/Pods-<project name>/Pods-<project name>.debug.xcconfig' in your build configuration ('cordova/build-debug.xcconfig').

Is there any easy config change to remedy this issue? If so, could you document it?

Thanks!

Lucas

Plugin messes up `platforms/ios/cordova/lib/build.js`

EDIT: cordova version installed 6.4.0, cordova-ios platform version installed 4.3.1, also tried with 4.4.0

This is how to reproduce the error

cordova create pod-test
cd pod-test/
cordova platform add ios --save
# this command succeeds 
cordova build ios
# this is currently 1.2.11 but I have also tried with 1.2.10
cordova plugin add https://github.com/blakgeek/cordova-plugin-cocoapods-support.git --save
# this command fails
cordova build ios --verbose

This is the error returned

Error: SyntaxError: Unexpected number
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at /Users/fonz/Desktop/pod-test/platforms/ios/cordova/Api.js:417:16
    at _fulfilled (/Users/fonz/Desktop/pod-test/platforms/ios/cordova/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/Users/fonz/Desktop/pod-test/platforms/ios/cordova/node_modules/q/q.js:863:30)

Because this is syntactically incorrect, notice the quotes.

options = [
    '-xcconfig', customArgs.xcconfig || path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
    '-workspace', customArgs.project || projectName + '.xcworkspace',
    '-scheme', customArgs.scheme || projectName,
    '-configuration', customArgs.configuration || configuration,
    '-sdk', customArgs.sdk || 'iphonesimulator',
    '-destination generic/platform=iOS',name=iPhone 5s'
];

Using local pod / podspec

Hi,

I'm wondering if the plugin allows us to use local pod ?
I'm developing a SDK and want to create a cordova plugin before release it on a cocoapods spec repo.

Thanks a lot in advance.

How to add pod for specified target?

In order to add this to Podfile of my app:

target 'OneSignalNotificationServiceExtension' do
	pod 'OneSignalXCFramework', '>= 5.0', '< 6.0'
end

I add this line to config.xml:
<pod name="OneSignalXCFramework" target="OneSignalNotificationServiceExtension" spec="~> 5.0.0" />

But the generated output is this:

target 'MyMainTarget' do
	pod 'OneSignalXCFramework', '~> 5.0.0'
end

What is the way to replace "MyMainTarget" with "OneSignalNotificationServiceExtension"?

Loading pod via git link loads wrong pod

Hello,
i'm developing a customized version of cordova-plugin-document-scanner and I want to use a customized version of the WeScan library. I forked both and tried to load WeScan via cocoapods-support from a github repository. But every time I add the ios platform to my project via 'ionic cap add ios' the original WeScan library is fetched and added to the iOS folder. My plugin.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-plugin-document-scanner" version="4.3.0">

  <name>Scan</name>
  <engines>
    <engine name="cordova-android" version=">=6.4.0" />
  </engines>
  <asset src="www/scan.js" target="js/scan.js"/>
  <js-module src="www/scan.js" name="scan">
    <clobbers target="scan" />
  </js-module>

  <platform name="android">
    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="Scan">
        <param name="android-package" value="com.neutrinos.plugin.Scan"/>
      </feature>
    </config-file>

    <source-file src="src/android/Scan.java" target-dir="src/com/neutrinos/plugin/" />
    <source-file src="src/android/FileHelper.java" target-dir="src/com/neutrinos/plugin/" />
    <framework src="src/android/build.gradle" custom="true" type="gradleReference"/>
  </platform>


  <platform name="ios">
    <config-file target="config.xml" parent="/*">
      <feature name="Scan">
        <param name="ios-package" value="Scan" />
      </feature>
    </config-file>

    <source-file src="src/ios/Scan.swift" />

    <dependency id="cordova-plugin-add-swift-support" version="^2.0.2"/>
    <dependency id="cordova-plugin-cocoapod-support"/>
    <pods-config ios-min-version="11.0" use-frameworks="true">

    </pods-config>
    <pod name="WeScan" git="https://github.com/kbs-fabfel/WeScan" commit="b289866"/>

    <preference name="CAMERA_USAGE_DESCRIPTION" default="This app needs camera access"/>
    <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
      <string>$CAMERA_USAGE_DESCRIPTION</string>
    </config-file>

    <preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default="This app needs read/write-access photo library access"/>
    <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
      <string>$PHOTOLIBRARY_USAGE_DESCRIPTION</string>
    </config-file>
    
  </platform>

</plugin>

Any ideas, why the original library is fetched instead of the forked one?

Preferences pods_ios_min_version not recognized

Hi,
I need to fix the ios min version to 9.0 for my cordova plugin, but when I simply add <preference name="pods_ios_min_version" value="9.0"/>, in my plugin.xml, I just get an error during the plugin's installation :

Error: Variable(s) missing: PODS_IOS_MIN_VERSION

It looks like cordova doesn't accept a preference he doesn't know...

Plugin is broken using cordova cli 9.0.0

Using the latest cordova cli version, this plugin prevents the project to build.

cordova create test
cd test
cordova platform add ios
cordova build ios

So far, the build is successful

cordova plugin add cordova-plugin-cocoapod-support
cordova build ios

The project doesn't build and here is the output:

Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

The method requireCordovaModule is used in podify.js. This method has been deprecated (see: apache/cordova-lib#707)

Failed to install 'my-plugin-name': Error: Variable(s) missing: PODS_IOS_MIN_VERSION

Has anyone else run into this? See error and platforms xml below. The plugin is added to the project. Thanks in advance!

Failed to install 'x-y-z': Error: Variable(s) missing: PODS_IOS_MIN_VERSION
    at Object.mergeVariables (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/variable-merge.js:58:15)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:315:44
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

My xml looks like this:

<platform name="ios">
	<config-file target="config.xml" parent="/*">
            <feature name="MyPlugin">
                <param name="ios-package" value="MyPluginSwift" />
            </feature>
        </config-file>
        <preference name="pods_ios_min_version" value="8.0"/>
	<pod name="MyPlugin" git="https://github.com/cyclic/MyPlugin" branch="develop" />
        <source-file src="src/ios/Yada.swift" target-dir="src/com/yada/plugin" />
    </platform>

lib isn't installed

hello,
i develop my custom plugin and in plugin xml i use following code

<platform name="ios">

        <dependency id="cordova-plugin-cocoapod-support"/>
 <dependency id="cordova-plugin-add-swift-support" version="1.6.1"/>

<pods-config ios-min-version="9.0" use-frameworks="true"/>

<pod id="Firebase/Core" version = "4.0.3" />



</platform>

when i add plugin everything goes fine but in the pod file Firebase/Core didn't present and also wasn't installed in project

Broken with latest Builds

Hi, I was really happy to see that I can include cocoapods directly in my plugin.xml.
Unfortunately I'm not being able to compile my project in Xcode anymore once I've included this plugin.

Steps to reproduce:

mkdir cocoapods
cd cocoapods
meteor create .
meteor add-platform ios
meteor add cordova:[email protected]
meteor run ios-device

Meteor 1.4.4.2
Xcode 8.3.2

screen shot 2017-05-21 at 13 06 57

Any suggestions?

Best Regards

uses-frameworks="true" in plugin.xml doesnt set use_frameworks! in Podfile

I have a plugin that includes this plugin as a dependency and configures a few pods. In the plugin I use the following configuration

        <dependency id="cordova-plugin-cocoapod-support" version="1.2.14" />

        <pods-config ios-min-version="8.0" uses-frameworks="true"/>    
        <pod id="GoogleConversionTracking" version="3.4.0"/>
        <pod id="FirebaseAppIndexing" version="1.0.3"/>

However, when I rm and add the ios platform, the Podfile does not have use_frameworks! in Podfile. If I also add the preference
in the project that uses the plugin, then use_frameworks! is added to the Podfile, however I would expect the plugin config to take care of that so users who use the plugin dont have to add this in their project.

plugin removes previously installed Cordova pods

I have a custom Cordova plugin that adds this plugin as a dependency. This plugin places my pods configuration in a config file platforms/ios/.pods.json

I also use the phonegap-push-plugin which uses the Cordova 6.X CLI to install pods for GoogleCloudMessaging and GGLInstanceID, which are configured in a file platforms/ios/pods.json

The problem is when this plugin runs, it will remove the existing pods in the Podfile (the push plugin pods) and add the pods form the plugin that reference the <pod element.

I would expect this plugin to be able to merge the Pods with Cordova 6.X pods.json file so plugins that also include pods will work as expected.

Using the Cordova 6.x CLI for pods is not an option for me currently since I need to include use_frameworks true, as well as using a tag for a specific pod.

Thanks!

Subsequent Builds Fail

All subsequent build attempts are failing for me, requiring a wipe of platforms/plugins directories before a new build will succeed. The error:

ld: library not found for -lPods-appName
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

The following build commands failed:
Ld build/emulator/appName.app/appName normal i386
(1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,path-to-workspace/platforms/ios/cordova/build-debug.xcconfig,-project,appName.xcodeproj,ARCHS=i386,-target,I am,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=path-to-workspace/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=path-to-workspace/platforms/ios/build/sharedpch

E.g.

  1. Start with a clean project
  2. ionic state restore
  3. ionic build ios
  4. Note build is successful
  5. ionic build ios
  6. Note build failed

Error: Cannot find module 'glob'

cordova plugin add cordova-plugin-cocoapod-support --save
Fetching plugin "cordova-plugin-cocoapod-support" via npm
Installing "cordova-plugin-cocoapod-support" for ios
Saved plugin info for "cordova-plugin-cocoapod-support" to config.xml
~/app$ cordova build ios
Error: Cannot find module 'glob'

Any ideas, I also installed npm -g install glob, still the same issue

Bad platform version

Hello

Thanks for the plugin, struggled this summer while using Cocoa Pods with Cordova (a real PITA) so I really enjoy your work which allows a cleaner build script.

However I lost few hours today figuring out why I couldn't install the cocoa dependencies (not being an iOS developer wasn't helping). Finally I noticed this :

  • config.xml contains the entry deployment-target specifying 8.0
  • the generated XCode project properly uses this value and defines its Deployment Target value to 8.0
  • but the Podfile contains: platform :ios, '7.0'

I am using the 1.2.10 release.

Easy to reproduce:

  • cordova platform rm ios
  • cordova plugin rm cordova-plugin-cocoapod-support (--force if needed)
  • cordova plugin add cordova-plugin-cocoapod-support
  • cordova platform add ios

Same result

  • config.xml defines 8.0
  • XCode project says 8.0
  • Podfile containes 7.0

xcodebuild: error: Unable to find a destination matching the provided destination specifier

After installing the cordova-cocoapods-support plugin to an ionic project, I get the following error when running "ionic build ios":

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
                { platform:iOS Simulator }

        Missing required device specifier option.
        The device type “iOS Simulator” requires that either “name” or “id” be specified.
        Please supply either “name” or “id”.

Imported type swift framework using `cordova run ios` running error

My project file config.xml was introduced

<platform name="ios">
    <preference name="deployment-target" value="9.0" />
    <preference name="pods_use_frameworks" value="true" />
    <preference name="UseSwiftLanguageVersion" value="4" />
    <pod name="RxSwift" />
    <pod name="RxCocoa" />
</platform>

<plugin name="cordova-plugin-cocoapod-support" spec="^1.5.0" />
<plugin name="cordova-plugin-add-swift-support" spec="^1.7.2" />
Xcode 9.2
cordova 8.0.0
cordova-ios 4.5.4
ios target 9.0

I set my own termId and set the Swift Language Version to Swift 4.0 in the Pods project, and it can run successfully in Xcode, but I used cordova run ios and I got some errors.

ld: warning: directory not found for option '-F/Users/kain/Library/Developer/Xcode/DerivedData/map-fvvjdyiqslzkzzelbljbiknglydw/Build/Intermediates.noindex/ArchiveIntermediates/map/BuildProductsPath/Debug-iphoneos/RxCocoa'
ld: warning: directory not found for option '-F/Users/kain/Library/Developer/Xcode/DerivedData/map-fvvjdyiqslzkzzelbljbiknglydw/Build/Intermediates.noindex/ArchiveIntermediates/map/BuildProductsPath/Debug-iphoneos/RxSwift'
ld: framework not found RxCocoa
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** ARCHIVE FAILED **


The following build commands failed:
        Ld /Users/kain/Library/Developer/Xcode/DerivedData/map-fvvjdyiqslzkzzelbljbiknglydw/Build/Intermediates.noindex/ArchiveIntermediates/map/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/RxSwift.build/Objects-normal/armv7/RxSwift normal armv7
        Ld /Users/kain/Library/Developer/Xcode/DerivedData/map-fvvjdyiqslzkzzelbljbiknglydw/Build/Intermediates.noindex/ArchiveIntermediates/map/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/RxSwift.build/Objects-normal/arm64/RxSwift normal arm64
(2 failures)
(node:7029) UnhandledPromiseRejectionWarning: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/kain/workspace/AppProjects/map/platforms/ios/cordova/build-debug.xcconfig,-workspace,map.xcworkspace,-scheme,map,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,map.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/kain/workspace/AppProjects/map/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/kain/workspace/AppProjects/map/platforms/ios/build/sharedpch
(node:7029) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7029) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I searched for google and tested some methods, but still can't solve the problem, I don't know why.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.