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;

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

Get JavaScript Mobile Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.