Phonegap - plugin extension for iOS

I read about how to create a new Phonegap plugin and seem to get it by following this guide.

http://wiki.phonegap.com/w/page/36753496/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20iOS

However, it’s hard for me to figure out how to extend an existing plugin. (without creating a new one)
I read this lesson.

http://hiediutley.com/2011/03/28/phonegap-tutorial-series-3-extending-the-phonegap-api/

I can't seem to find where I can add a line of codes to the .m file. In my Xcode, I see only .h files, but not the .m file.
Or is there a better way to extend api?

Thanks,
Tee

+4
source share
1 answer

EDIT: This answer is no longer completely correct.

The latest versions of Cordova / PhoneGap are not a compiled structure, and it’s much easier (especially since version 2.2.0) to configure the version of the cord that a specific application uses, since it is just a subproject in Xcode.

To get into the .m files, you will need to download the source of iOS PhoneGap (Cordova) and make changes to compiling their own version of PhoneGap framework.

It's not as complicated as it sounds, but it can be a little complicated if you are not very comfortable using Objective-C and command line compilation tools.

To rephrase README from an iOS source, for example:

$ git clone http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios.git

Make your changes, then ...

  • Run "Terminal.app"
  • Go to the folder where the Makefile is located (./PhoneGapLib?)
  • Type make , then press Enter

This should create "PhoneGapInstaller.dmg" in the dist folder. This is what you use to install the new version of PhoneGap.

Another option is to take the .m and .h API files that you distribute (just by getting them from the GitHub source repository) and turning them into a new plugin with your own name. As an example, instead of expanding the camera API and making changes to Camera.m and recompiling, etc., I decided to make the plugin nameless MyCamera, which had code from the camera API and my own extensions. Most of the APIs in PhoneGap (at least in iOS) are basically plugins in their own right, so they don’t have to configure much to turn them into a plugin for your purposes.

This method also means that you can update PhoneGap later and not hide all your extensions.

+2
source

Source: https://habr.com/ru/post/1397922/


All Articles