SlideShare a Scribd company 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?

More Related Content

What's hot

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 remarksDamian 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
 

What's hot (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
 

Similar to 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 PhoneGapDoncho 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 guidemagicshui
 
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
 

Similar to 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
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 

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?