SlideShare une entreprise Scribd logo
Cordova
iOS Native Plugin
Development
MOBILE APP DEVELOPMENT FOR WEB DEVELOPERS.
JOSUE BUSTOS
Artist, Software Developer
@hozwe
npmjs.com/package/cordova-plugin-base64binary
https://www.behance.net/hozwe
https://www.linkedin.com/in/josuebustos
Follow me on…
Plugin development for iOS
 Xcode IDE
 iOS Device (recommended)
 iOS simulator
 Some familiarity with writing Objective-C code.
 Some experience implementing Cocoa Touch API’s.
 Cordova CLI must be installed.
 Cordova Plugman must be installed.
 A machine with Mac OSX installed.
Some Items you will need to get started for iOS native plugin development.
Configuring your plugin project
 plugin.xml
 The JavaScript interface
 Objective-C source code
 package.json
 Publish your plugin
Creating a plugin project
Open terminal window and type in the following text. You can copy paste the text here into
your terminal and modify it.
plugman create --name testPlugin --plugin_id cordova-
plugin-openwith --plugin_version 0.0.1 --path
/Users/myname/Desktop/firstplugin
Sample generated plugin project
plugin.xml starter
<?xml version="1.0" encoding="UTF-8"?> <plugin
xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-device"
version="0.2.3">
<name>Device</name>
<description>Your plugin description</description>
<license>Your license 2.0</license>
<keywords>Your, Plugin, Is, Unique</keywords>
<js-module src="www/testPlugin.js" name="device”>
<clobbers target=”Plugin" /></js-module>
</plugin>
iOS platform-specific
<platform name="ios">
<config-file target="config.xml" parent="/*”>
<feature name=”Echo">
<param name="ios-package" value=”Echo"/>
</feature>
</config-file>
<header-file src="src/ios/TestPlugin.h" />
<source-file src="src/ios/TestPlugin.m" />
</platform>
The JavaScript interface
// in your www/testPlugin.js plugin project
window.echo = function(str, callback) {
cordova.exec(callback, function(err) {
callback('Nothing to echo.'); },
"Echo",
"echo",
[str]
);
};
// in your www/index.js development project.
window.echo("echome", function(echoValue) {
alert(echoValue == "echome"); // should alert true.
});
Objective-C plugin class
/********* TestPlugin.h Cordova Plugin Header *******/
#import <Cordova/CDVPlugin.h>
@interface
Echo : CDVPlugin
- (void) echo:(CDVInvokedUrlCommand*)command;
@end
/********* TestPlugin.m Cordova Plugin Implementation *******/
#import ”TestPlugin.h" #import <Cordova/CDVPlugin.h>
@implementation Echo - (void)echo:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; }
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
Create package.json
Copy paste the text below into your terminal and press enter. This will create a
package.json file into your root directory of your plugin project. Learn more about why this
file is needed on the cordova blog.
plugman createpackagejson /path/to/your/plugin
Sample package.json
{
name: "cordova-plugin-yourpluginname",
version: ”0.0.1 ",
description: ”Description of your plugin goes here",
cordova:
{
id: "cordova-plugin-yourpluginname",
platforms:
[“ios”]
},
repository:
{
type: "git",
url: "https://github.com/Joewsh/cordova-plugin-yourpluginname"
},
keywords:
["cordova”,”sample”,"ecosystem:cordova”,"cordova-ios”],
"author": {
"name": ”Your Name", "email": ”your@email.com", "url": "http://yourwebsite.com"
},
"license": "MIT",
"bugs": {
"url": “https://github.com/username/cordova-plugin-yourpluginname/isues"
},
"homepage": https://github.com/username/cordova-plugin-yourpluginname#readme
}
Final plugin project
Testing your plugin
To test your plugin type out or copy paste the text into your terminal and press return. You
can modify the command to specify your native environment.
NOTE: While testing, plugins must be installed in the platform specific directory. See next
slide for example.
plugman install --platform ios –project
/path/to/your/app/platforms/ios --plugin
/path/to/my/plugin
A test app
project with a
test plugin
installed.
Publish your plugin to NPM
// Enter the command below if you never published to the NPM
registry.
npm adduser
// Enter the command below after adding a user successfully
// you can also reuse this command to update your plugin
npm publish /path/to/your/plugin
// that’s it!!
After hours of debugging your native plugin and making sure it works in various scenarios.
You can now publish it to the NPM registry using the terminal command below.
Need help?
 Cordova Plugin Development Guide
 What else can Apache Cordova do?

Contenu connexe

Tendances

webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slides
mattysmith
 
node-webkit : Make a magic from your a desktop app to desktop app!
node-webkit : Make a magic from your a desktop app to desktop app!node-webkit : Make a magic from your a desktop app to desktop app!
node-webkit : Make a magic from your a desktop app to desktop app!
욱진 양
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
Wittawas Wisarnkanchana
 
Passo a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel HíbridaPasso a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel Híbrida
Juliano Martins
 
Considerations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteConsiderations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke site
Engage Software
 
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Philipp Burgmer
 
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and SaucelabsiOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
Shashikant Jagtap
 
Packaging DNN extensions
Packaging DNN extensionsPackaging DNN extensions
Packaging DNN extensions
Engage Software
 
Jenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And GroovyJenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And Groovy
Daniel Spilker
 
Writing a Jenkins / Hudson plugin
Writing a Jenkins / Hudson pluginWriting a Jenkins / Hudson plugin
Writing a Jenkins / Hudson plugin
Anthony Dahanne
 
Introduction to Google Chrome Extensions Development
Introduction to Google Chrome Extensions DevelopmentIntroduction to Google Chrome Extensions Development
Introduction to Google Chrome Extensions Development
Jomar Tigcal
 
Bringing Javascript to the Desktop with Electron
Bringing Javascript to the Desktop with ElectronBringing Javascript to the Desktop with Electron
Bringing Javascript to the Desktop with Electron
Nir Noy
 
Deploy Node.js application in Heroku using Eclipse
Deploy Node.js application in Heroku using EclipseDeploy Node.js application in Heroku using Eclipse
Deploy Node.js application in Heroku using Eclipse
Jitendra Zaa
 
Gradle + Google I/O 2014 remarks
Gradle + Google I/O 2014 remarksGradle + Google I/O 2014 remarks
Gradle + Google I/O 2014 remarks
Damian Mee
 
NativeScript: mobile app. no webview.
NativeScript: mobile app. no webview.NativeScript: mobile app. no webview.
NativeScript: mobile app. no webview.
Tomek Sułkowski
 
Modern web applications
Modern web applicationsModern web applications
Modern web applications
Andrea Tino
 
2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins
Huang Bruce
 
Workshop - Golang language
Workshop - Golang languageWorkshop - Golang language
Workshop - Golang language
Vincent Composieux
 
ITB2019 CommandBox vs Node.js - Nolan Erck
ITB2019  CommandBox vs Node.js - Nolan ErckITB2019  CommandBox vs Node.js - Nolan Erck
ITB2019 CommandBox vs Node.js - Nolan Erck
Ortus Solutions, Corp
 
Welcome to Jenkins
Welcome to JenkinsWelcome to Jenkins
Welcome to Jenkins
Somkiat Puisungnoen
 

Tendances (20)

webpack 101 slides
webpack 101 slideswebpack 101 slides
webpack 101 slides
 
node-webkit : Make a magic from your a desktop app to desktop app!
node-webkit : Make a magic from your a desktop app to desktop app!node-webkit : Make a magic from your a desktop app to desktop app!
node-webkit : Make a magic from your a desktop app to desktop app!
 
Cross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkitCross-platform Desktop application with AngularJS and build with Node-webkit
Cross-platform Desktop application with AngularJS and build with Node-webkit
 
Passo a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel HíbridaPasso a Passo para criar uma aplicação Móvel Híbrida
Passo a Passo para criar uma aplicação Móvel Híbrida
 
Considerations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke siteConsiderations with Writing JavaScript in your DotNetNuke site
Considerations with Writing JavaScript in your DotNetNuke site
 
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
Grunt, Gulp & fabs: Build Systems and Development-Workflow for Modern Web-App...
 
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and SaucelabsiOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
iOS Developers Conference-iOS Automation with Cucumber, Appium and Saucelabs
 
Packaging DNN extensions
Packaging DNN extensionsPackaging DNN extensions
Packaging DNN extensions
 
Jenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And GroovyJenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And Groovy
 
Writing a Jenkins / Hudson plugin
Writing a Jenkins / Hudson pluginWriting a Jenkins / Hudson plugin
Writing a Jenkins / Hudson plugin
 
Introduction to Google Chrome Extensions Development
Introduction to Google Chrome Extensions DevelopmentIntroduction to Google Chrome Extensions Development
Introduction to Google Chrome Extensions Development
 
Bringing Javascript to the Desktop with Electron
Bringing Javascript to the Desktop with ElectronBringing Javascript to the Desktop with Electron
Bringing Javascript to the Desktop with Electron
 
Deploy Node.js application in Heroku using Eclipse
Deploy Node.js application in Heroku using EclipseDeploy Node.js application in Heroku using Eclipse
Deploy Node.js application in Heroku using Eclipse
 
Gradle + Google I/O 2014 remarks
Gradle + Google I/O 2014 remarksGradle + Google I/O 2014 remarks
Gradle + Google I/O 2014 remarks
 
NativeScript: mobile app. no webview.
NativeScript: mobile app. no webview.NativeScript: mobile app. no webview.
NativeScript: mobile app. no webview.
 
Modern web applications
Modern web applicationsModern web applications
Modern web applications
 
2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins
 
Workshop - Golang language
Workshop - Golang languageWorkshop - Golang language
Workshop - Golang language
 
ITB2019 CommandBox vs Node.js - Nolan Erck
ITB2019  CommandBox vs Node.js - Nolan ErckITB2019  CommandBox vs Node.js - Nolan Erck
ITB2019 CommandBox vs Node.js - Nolan Erck
 
Welcome to Jenkins
Welcome to JenkinsWelcome to Jenkins
Welcome to Jenkins
 

Similaire à Cordova iOS Native Plugin Development

Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
rajkamaltibacademy
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
Candice Zhuang
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
Yu-Hsuan Chuang
 
DevNet Associate : Python introduction
DevNet Associate : Python introductionDevNet Associate : Python introduction
DevNet Associate : Python introduction
Joel W. King
 
[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In Action[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In Action
Hazem Saleh
 
Getting Your Hooks Into Cordova
Getting Your Hooks Into CordovaGetting Your Hooks Into Cordova
Getting Your Hooks Into Cordova
devObjective
 
Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGap
Doncho Minkov
 
iOS App Using cordova
iOS App Using cordovaiOS App Using cordova
iOS App Using cordova
Mitosis Technology
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020
Bogusz Jelinski
 
CocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPodsCocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPods
CocoaHeadsRNS
 
PhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J KrishnanPhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J Krishnan
OrisysIndia
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS Apps
Sarath C
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 
Lezione 02 React and React Native installation and Configuration
Lezione 02   React and  React Native installation and ConfigurationLezione 02   React and  React Native installation and Configuration
Lezione 02 React and React Native installation and Configuration
University of Catania
 
React native on windows
React native on windowsReact native on windows
React native on windows
Abdul Karim
 
React Native
React NativeReact Native
React Native
Craig Jolicoeur
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
magicshui
 
Pluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with DockerPluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with Docker
Elton Stoneman
 
Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]
Sentinel Solutions Ltd
 
GDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWSGDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWS
Ladislav Prskavec
 

Similaire à Cordova iOS Native Plugin Development (20)

Angularjs Tutorial for Beginners
Angularjs Tutorial for BeginnersAngularjs Tutorial for Beginners
Angularjs Tutorial for Beginners
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
DevNet Associate : Python introduction
DevNet Associate : Python introductionDevNet Associate : Python introduction
DevNet Associate : Python introduction
 
[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In Action[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In Action
 
Getting Your Hooks Into Cordova
Getting Your Hooks Into CordovaGetting Your Hooks Into Cordova
Getting Your Hooks Into Cordova
 
Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGap
 
iOS App Using cordova
iOS App Using cordovaiOS App Using cordova
iOS App Using cordova
 
Mobile development in 2020
Mobile development in 2020 Mobile development in 2020
Mobile development in 2020
 
CocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPodsCocoaHeads Rennes #13 : CocoaPods
CocoaHeads Rennes #13 : CocoaPods
 
PhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J KrishnanPhoneGap Application Development - Santhi J Krishnan
PhoneGap Application Development - Santhi J Krishnan
 
Fastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS AppsFastlane - Automation and Continuous Delivery for iOS Apps
Fastlane - Automation and Continuous Delivery for iOS Apps
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Lezione 02 React and React Native installation and Configuration
Lezione 02   React and  React Native installation and ConfigurationLezione 02   React and  React Native installation and Configuration
Lezione 02 React and React Native installation and Configuration
 
React native on windows
React native on windowsReact native on windows
React native on windows
 
React Native
React NativeReact Native
React Native
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Pluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with DockerPluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with Docker
 
Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]
 
GDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWSGDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWS
 

Dernier

Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 

Dernier (20)

Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 

Cordova iOS Native Plugin Development

  • 1. Cordova iOS Native Plugin Development MOBILE APP DEVELOPMENT FOR WEB DEVELOPERS.
  • 4. Plugin development for iOS  Xcode IDE  iOS Device (recommended)  iOS simulator  Some familiarity with writing Objective-C code.  Some experience implementing Cocoa Touch API’s.  Cordova CLI must be installed.  Cordova Plugman must be installed.  A machine with Mac OSX installed. Some Items you will need to get started for iOS native plugin development.
  • 5. Configuring your plugin project  plugin.xml  The JavaScript interface  Objective-C source code  package.json  Publish your plugin
  • 6. Creating a plugin project Open terminal window and type in the following text. You can copy paste the text here into your terminal and modify it. plugman create --name testPlugin --plugin_id cordova- plugin-openwith --plugin_version 0.0.1 --path /Users/myname/Desktop/firstplugin
  • 8. plugin.xml starter <?xml version="1.0" encoding="UTF-8"?> <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-device" version="0.2.3"> <name>Device</name> <description>Your plugin description</description> <license>Your license 2.0</license> <keywords>Your, Plugin, Is, Unique</keywords> <js-module src="www/testPlugin.js" name="device”> <clobbers target=”Plugin" /></js-module> </plugin>
  • 9. iOS platform-specific <platform name="ios"> <config-file target="config.xml" parent="/*”> <feature name=”Echo"> <param name="ios-package" value=”Echo"/> </feature> </config-file> <header-file src="src/ios/TestPlugin.h" /> <source-file src="src/ios/TestPlugin.m" /> </platform>
  • 10. The JavaScript interface // in your www/testPlugin.js plugin project window.echo = function(str, callback) { cordova.exec(callback, function(err) { callback('Nothing to echo.'); }, "Echo", "echo", [str] ); }; // in your www/index.js development project. window.echo("echome", function(echoValue) { alert(echoValue == "echome"); // should alert true. });
  • 11. Objective-C plugin class /********* TestPlugin.h Cordova Plugin Header *******/ #import <Cordova/CDVPlugin.h> @interface Echo : CDVPlugin - (void) echo:(CDVInvokedUrlCommand*)command; @end /********* TestPlugin.m Cordova Plugin Implementation *******/ #import ”TestPlugin.h" #import <Cordova/CDVPlugin.h> @implementation Echo - (void)echo:(CDVInvokedUrlCommand*)command { CDVPluginResult* pluginResult = nil; NSString* echo = [command.arguments objectAtIndex:0]; if (echo != nil && [echo length] > 0) { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo]; } else { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; } [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } @end
  • 12. Create package.json Copy paste the text below into your terminal and press enter. This will create a package.json file into your root directory of your plugin project. Learn more about why this file is needed on the cordova blog. plugman createpackagejson /path/to/your/plugin
  • 13. Sample package.json { name: "cordova-plugin-yourpluginname", version: ”0.0.1 ", description: ”Description of your plugin goes here", cordova: { id: "cordova-plugin-yourpluginname", platforms: [“ios”] }, repository: { type: "git", url: "https://github.com/Joewsh/cordova-plugin-yourpluginname" }, keywords: ["cordova”,”sample”,"ecosystem:cordova”,"cordova-ios”], "author": { "name": ”Your Name", "email": ”your@email.com", "url": "http://yourwebsite.com" }, "license": "MIT", "bugs": { "url": “https://github.com/username/cordova-plugin-yourpluginname/isues" }, "homepage": https://github.com/username/cordova-plugin-yourpluginname#readme }
  • 15. Testing your plugin To test your plugin type out or copy paste the text into your terminal and press return. You can modify the command to specify your native environment. NOTE: While testing, plugins must be installed in the platform specific directory. See next slide for example. plugman install --platform ios –project /path/to/your/app/platforms/ios --plugin /path/to/my/plugin
  • 16. A test app project with a test plugin installed.
  • 17. Publish your plugin to NPM // Enter the command below if you never published to the NPM registry. npm adduser // Enter the command below after adding a user successfully // you can also reuse this command to update your plugin npm publish /path/to/your/plugin // that’s it!! After hours of debugging your native plugin and making sure it works in various scenarios. You can now publish it to the NPM registry using the terminal command below.
  • 18. Need help?  Cordova Plugin Development Guide  What else can Apache Cordova do?