Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript Mobile Application Development

You're reading from  JavaScript Mobile Application Development

Product type Book
Published in Oct 2014
Publisher
ISBN-13 9781783554171
Pages 332 pages
Edition 1st Edition
Languages
Toc

Table of Contents (15) Chapters close

JavaScript Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. An Introduction to Apache Cordova 2. Developing Your First Cordova Application 3. Apache Cordova Development Tools 4. Cordova API in Action 5. Diving Deeper into the Cordova API 6. Developing Custom Cordova Plugins 7. Unit Testing the Cordova App's Logic 8. Applying it All – the Mega App Index

Developing iOS code


As specified in our plugin.xml file's platform section for iOS, the implementation of our plugin in iOS is located at the src/ios/Sms.h and src/ios/Sms.m Objective-C files. The following code snippet shows the Sms.h file (the header file):

#import <Cordova/CDV.h>
#import <MessageUI/MFMessageComposeViewController.h>

@interface Sms : CDVPlugin <MFMessageComposeViewControllerDelegate> {
}

@property(strong) NSString* callbackID;
- (void)sendMessage:(CDVInvokedUrlCommand*)command;
@end

The preceding code declares an Sms class that extends CDVPlugin. It is important to note that in order to create a Cordova iOS plugin class, our Objective-C plugin class must extend the CDVPlugin class. In our Sms class declaration, there is a declared callbackID property of the NSString type and a declared sendMessage method, which returns void and takes CDVInvokedUrlCommand as a parameter. Now, let's move on to the Sms class implementation. The following code snippet shows...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}