Skip to content

Commit d147060

Browse files
authored
migrate native docs to use capacitor (#2684)
* migrate native docs to use capacitor * test build fix * fix native build
1 parent b1bb1b7 commit d147060

File tree

10 files changed

+258
-448
lines changed

10 files changed

+258
-448
lines changed

docs/native-community.md

Lines changed: 0 additions & 200 deletions
This file was deleted.

docs/native-faq.md

Lines changed: 11 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,23 @@ sidebar_label: FAQ
33
slug: /native/faq
44
---
55

6-
# Ionic Native FAQ
6+
# Frequently Asked Question
77

8-
## Cordova Management Tips
8+
## What is Capacitor?
99

10-
**1) Use the [Ionic CLI](cli.md) to add/update/delete plugins.**
10+
Capacitor a native runtime built by the Ionic team that offers web developers the ability to deploy their web apps to a native device. Capacitor also exposing native device capabilities through JavaScript so developers could access features like native location services, filesystem access, or notifications as if they are interacting with any other JavaScript library.
1111

12-
Instead of directly editing `config.xml` and `package.json`. Use `ionic` in front of Cordova commands for a better experience and additional functionality (`ionic cordova build ios` instead of `cordova build ios`).
12+
## Permission Issues
1313

14-
**2) Upgrade plugins by removing, then re-adding them.**
14+
If you're using a plugin, it may require adding additional permissions to your native project after you install the plugin. For instance, the Capacitor Camera plugin requires the following permission for iOS:
1515

16-
```shell
17-
$ ionic cordova plugin remove cordova-plugin-camera
18-
$ ionic cordova plugin add cordova-plugin-camera
19-
```
16+
- `NSCameraUsageDescription` (`Privacy - Camera Usage Description`)
17+
- `NSPhotoLibraryAddUsageDescription` (`Privacy - Photo Library Additions Usage Description`)
18+
- `NSPhotoLibraryUsageDescription` (`Privacy - Photo Library Usage Description`)
2019

21-
**3) Install explicit versions.**
20+
You need to manually add those permissions to the `info.plist` in your native project. Otherwise, calls to the native camera API will fail.
2221

23-
To ensure that the same version of a plugin is always installed via `npm install`, specify the version number:
2422

25-
```shell
26-
ionic cordova plugin add [email protected]
27-
```
23+
## Unexpected behaviour
2824

29-
**4) Restore Cordova in an existing Ionic project**
30-
31-
Useful when adding new developers to a project. `ionic cordova prepare` restores platforms and plugins from `package.json` and `config.xml`. The version to be installed is taken from `package.json` or `config.xml`, if found in those files. In case of conflicts, `package.json` is given precedence over `config.xml`.
32-
33-
**5) Troubleshoot Cordova issues with Ionic CLI commands**
34-
35-
- `ionic doctor list`: Detects [common issues](cli/commands/doctor-list.md) and suggests steps to fix them
36-
- `ionic repair`: Remove, then [regenerate](cli/commands/repair.md) all dependencies
37-
38-
## Understanding Version Numbers
39-
40-
For any given Ionic Native plugin, the Ionic Native (TypeScript code) and Cordova (native code) version numbers will not match. The Ionic Native version number is found in `package.json`:
41-
42-
```json
43-
"@awesome-cordova-plugins/camera": "^5.3.0",
44-
```
45-
46-
The Cordova plugin version number is found in both `package.json` and `config.xml`:
47-
48-
```json
49-
"cordova-plugin-camera": "4.0.3",
50-
```
51-
52-
```xml
53-
<plugin name="cordova-plugin-camera" spec="4.0.3" />
54-
```
55-
56-
When checking for new native functionality or bug fixes, look for new versions on the Cordova plugin GitHub page itself (here's the [Camera one](https://github.com/apache/cordova-plugin-camera), for example).
57-
58-
To check for new Ionic Native releases (may include exposing methods recently added by the Cordova plugin, etc.), see [here](https://github.com/ionic-team/ionic-native/releases).
59-
60-
## Troubleshooting Failed Builds
61-
62-
Research the build error(s) by checking out these resources:
63-
64-
- Google & [StackOverflow](https://stackoverflow.com): Many issues are documented online
65-
- Ask the [Ionic Community Ionic Forum](https://forum.ionicframework.com) (see the Ionic Native category)
66-
- See the Ionic Customer Success [Knowledge Base](https://ionic.zendesk.com)
67-
68-
### Cordova Plugin Conflicts
69-
70-
Plugins can conflict with each other when they share the same underlying native dependencies or when more than one plugin tries to access the same native code at once. For example, common libraries like the Google Play Services version (Google Maps is using GPS v24.2 but Firebase wants GPS v27.1). Keeping these plugins updated regularly can help with this.
71-
72-
Another tip is to ensure that your app uses only one plugin per specific feature/functionality (example: Push Notifications).
73-
74-
## Recommended Upgrade Strategy
75-
76-
The most Ionic stable apps are routinely updated, especially at the native layer. Keeping native plugins up to date ensures your project has the latest security fixes, new features, and improved performance.
77-
78-
Update your project's plugins one at a time, ideally in separate code branches. This reduces the surface area that issues can arise from - if you update everything in your project at once, it's sometimes hard to tell where the problem stems from.
79-
80-
### When should I update?
81-
82-
- When a new feature/bug is released: Run `npm outdated` to see a list of available updates.
83-
- When new major versions are released: Official blogs, such as the [Cordova blog](https://cordova.apache.org/blog/) and [Ionic blog](https://ionicframework.com/blog/), will publish announcements and news.
84-
- Evaluate the nature of the update: is it a shiny new feature or critical security fix?
85-
- Timing: Where does it fit in against your team's project goals?
25+
If for some reason the plugin does not behave in a way that is unexpected, please [open an issue on our github repo](https://github.com/ionic-team/capacitor-plugins)! Providing a clear issue report along with a reproduction can help get your issue resolved.

0 commit comments

Comments
 (0)