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

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.