1 | # cordova-plugin-cocoapod-support
|
2 | Are you tired of manually adding ios dependencies in Cordova apps? Me too. Android has Gradle support out of the box, but
|
3 | CocoaPods get no love. That is until now.
|
4 |
|
5 | With this plugin you can define your plugin or project CocoaPods dependencies right in your xml.
|
6 |
|
7 | After adding this plugin be sure to open the .xcworkspace in XCode instead of the .xcodeproj.
|
8 |
|
9 | *Note*: Dependencies defined in the config.xml take precedence of dependencies defined in plugin's.
|
10 |
|
11 | *Note*: The highest value of minimum ios version will be used and use_frameworks! will be enabled if the flag is set anywhere.
|
12 |
|
13 | ## How does it work?
|
14 | It looks for <pod> entries the config.xml and plugin.xml, creates the Podfile, updates the necessary configs and
|
15 | then runs pod update for you.
|
16 |
|
17 | ## How do I install it?
|
18 |
|
19 | If you're like me and using [Cordova CLI](http://cordova.apache.org/):
|
20 | ```
|
21 | cordova plugin add cordova-plugin-cocoapod-support --save
|
22 | ```
|
23 |
|
24 | or
|
25 |
|
26 | ```
|
27 | phonegap local plugin add cordova-plugin-cocoapod-support
|
28 | ```
|
29 |
|
30 | ## How do I use it?
|
31 |
|
32 | In a plugin's plugin.xml
|
33 | ```xml
|
34 | <?xml version='1.0' encoding='UTF-8'?>
|
35 | <plugin id="cordova-plugin-withpods" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
36 | <name>A Plugin With CocoaPods Dependencies</name>
|
37 | <description>
|
38 | A plugin demonstrating the use of CocoaPods dependencies.
|
39 | </description>
|
40 |
|
41 | <dependency id="cordova-plugin-cocoapod-support"/>
|
42 |
|
43 | <platform name="ios">
|
44 | <!-- optionally set minimum ios version and enable use_frameworks! -->
|
45 | <pods-config ios-min-version="9.0" use-frameworks="true"/>
|
46 | <pod id="LatestPod" />
|
47 | <pod id="VersionedPod" version="1.0.0" />
|
48 | <pod id="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" configuration="debug" />
|
49 | <pod id="GitPod2" git="https://github.com/blakgeek/something" branch="wood" configurations="release,debug" />
|
50 | <pod id="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />
|
51 | </platform>
|
52 | </plugin>
|
53 | ```
|
54 |
|
55 | In a project's config.xml
|
56 | ```xml
|
57 | <?xml version='1.0' encoding='utf-8'?>
|
58 | <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">
|
59 | <name>CocoapodsDemo</name>
|
60 | <description>
|
61 | An app demonstrating the use of CocoaPods dependencies.
|
62 | </description>
|
63 | <content src="index.html" />
|
64 | <access origin="*" />
|
65 | <platform name="ios">
|
66 | <!-- set platform :ios, defaults to 7.0 -->
|
67 | <preference name="pods_ios_min_version" value="8.0"/>
|
68 | <!-- add use_frameworks! to Podfile, this also disabled bridging headers -->
|
69 | <preference name="pods_use_frameworks" value="true"/>
|
70 | <pod id="LatestPod" />
|
71 | <pod id="VersionedPod" version="1.0.0" />
|
72 | <pod id="GitPod1" git="https://github.com/blakgeek/something" tag="v1.0.1" configuration="debug" />
|
73 | <pod id="GitPod2" git="https://github.com/blakgeek/something" branch="wood" configurations="release,debug" />
|
74 | <pod id="GitPod3" git="https://github.com/blakgeek/something" commit="1b33368" />
|
75 | <!-- if pod uses a bundle that isn't compatible with Cocoapods 1.x -->
|
76 | <pod id="BadBundle" fix-bundle-path="Bad/Path.bundle"/>
|
77 | </platform>
|
78 | </widget>
|
79 | ```
|
80 |
|
81 | ## Troubleshooting
|
82 | * If you get errors like the following.
|
83 | ```
|
84 | error: Resource ".../Build/Products/Debug-iphonesimulator/Lock/Auth0.bundle" not found. Run 'pod install' to update the copy resources script
|
85 | ```
|
86 | Add the fix-bundle-path attribute to the pod tag with the path after the device. In this case:
|
87 | ```xml
|
88 | <pod id="Lock" fix-bundle-path="Lock/Auth0.bundle"/>
|
89 | ```
|
90 | This is caused by a bug in the later versions of CocoaPods.
|
91 |
|
92 | or have a look at [the example plugin](https://github.com/blakgeek/cordova-plugin-cocoapods-support-example).
|
93 |
|
94 | ## Notes
|
95 | * Enabling the pods_use_frameworks preference disables the bridged headers property added by
|
96 | [CB-10072](https://issues.apache.org/jira/browse/CB-10072). This might cause odd behavior in some projects.
|
97 |
|
98 |
|
99 | ##TODO:
|
100 | * Update with examples of all of the supported pod attributes (git, podspec, path, subspec, configuration(s) )
|
101 |
|
102 |
|
103 |
|
104 | [bad_resource]: ./bad_resource.png "Bad Resource"
|
105 | [linker_error]: ./linker_error.png "Linker Error"
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|