You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CocoaPods.md
+26-13
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,14 @@ To work with such libraries, you need to wrap them as a custom NativeScript plug
12
12
## Install CocoaPods
13
13
You need to install CocoaPods. If you haven't yet, you can do so by running:
14
14
15
-
```
15
+
```bash
16
16
$ sudo gem install cocoapods
17
17
```
18
18
> **NOTE:** All operations and code in this article are verified against CocoaPods 0.38.2.
19
19
20
20
To check your current version, run the following command.
21
21
22
-
```
22
+
```bash
23
23
$ pod --version
24
24
```
25
25
@@ -33,26 +33,26 @@ sudo gem install cocoapods
33
33
To start, create a project and add the iOS platform.
34
34
35
35
```bash
36
-
$ tns create MYCocoaPods
37
-
$ cdMYCocoaPods
36
+
$ tns create MYCocoaPodsApp
37
+
$ cdMYCocoaPodsApp
38
38
$ tns platform add ios
39
39
```
40
40
41
41
## Wrap the Library as NativeScript Plugin
42
42
43
43
For more information about working with NativeScript plugins, click [here](PLUGINS.md).
44
44
45
-
```
45
+
```bash
46
46
cd ..
47
47
mkdir my-plugin
48
48
cd my-plugin
49
49
```
50
50
51
-
Create a package.json file with the following content:
51
+
Create a `package.json` file with the following content:
52
52
53
-
```
53
+
```json
54
54
{
55
-
"name": "myplugin",
55
+
"name": "my-plugin",
56
56
"version": "0.0.1",
57
57
"nativescript": {
58
58
"platforms": {
@@ -72,18 +72,31 @@ my-plugin/
72
72
└── Podfile
73
73
```
74
74
75
+
Podfile:
76
+
```
77
+
pod 'GoogleMaps'
78
+
```
79
+
80
+
## Install the Plugin
81
+
75
82
Next, install the plugin:
76
83
77
-
```
84
+
```bash
78
85
tns plugin add ../my-plugin
79
86
```
80
87
81
-
## Build the project
88
+
> **NOTE:** Installing CocoaPods sets the deployment target of your app to iOS 8, if not already set to iOS 8 or later. This change is required because CocoaPods are installed as shared frameworks to ensure that all symbols are available at runtime.
82
89
83
-
```
90
+
## Build the Project
91
+
92
+
```bash
84
93
tns build ios
85
94
```
86
95
87
-
This modifies the `MYCocoaPods.xcodeproj` and creates a workspace with the same name.
96
+
This modifies the `MYCocoaPodsApp.xcodeproj` and creates a workspace with the same name.
97
+
98
+
> **IMPORTANT:** You will no longer be able to run the `xcodeproj` alone. NativeScript CLI will build the newly created workspace and produce the correct package.
99
+
100
+
## Troubleshooting
88
101
89
-
> **IMPORTANT:** You will no longer be able to run the `xcodeproj` alone. NativeScript CLI will build the newly created workspace and produce the correct .ipa.
102
+
In case of post-build linker errors, you might need to resolve missing dependencies to native frameworks required by the installed CocoaPod. For more information about how to create the required links, see the [build.xcconfig specification](PLUGINS.md#buildxcconfig-specification).
0 commit comments