Texting on Apple Watch: How to Send a text from a Watch App in WatchOS2

Texting on Apple Watch: How to Send a text from a Watch App in WatchOS2
COMMENTS (0)
Tweet

Hey Guys, In this tutorial I’m going to show you how to leverage the watchOS 2 for texting on Apple Watch. This tutorial will enable you to open the message app and send a text, using the open system URL in a native Apple Watch app.

Introduction:

As you know at the WWDC 2015 event, Apple announced the first major update to the Watch OS, the watchOS 2. Along with a number of new features and enhancements, the most important feature that this update brought to the Apple Watch was the ability to create native Apple Watch apps. These native apps not only give better performance and improved usability, they can also leverage the Apple Watch’s hardware (like the digital crown, the microphone, health sensors, etc.) to perform certain functions, such as for example, using the Open System URL for making calls and sending text messages. In this tutorial I’m going to show you how to open the messages app for texting on Apple Watch, by using the Open System URL from a native apple watch app. This tutorial requires that you have XCode 7 running on Mac OS X Yosemite (10.10) or a later version, and an Apple Watch running watchOS 2, since the watch simulator cannot send and receive text messages like the iOS simulator. So let’s get started.

Setting Up the Project

First, open up Xcode and create a new project. You’ll notice that the project wizard includes a watchOS section on the left. Just select the iOS App with WatchKit App template from the watchOS > Application section and click Next (as depicted below).

Texting on Apple Watch

Next, fill in the required information Just name the app SMS and uncheck all checkboxes at the bottom, since we don’t need any of those for this particular app (as shown below).

Texting on Apple Watch  

Before adding anything to the project, we first need to configure XCode to build and run the correct app target. To do that just click the active scheme SMS and choose the following option:

Texting on Apple Watch

Now, click the play button to build and run your app.

2. Creating the User Interface

For the sake of simplicity, in this tutorial we’re just going to add a button and name it SMS in an interface controller.
Texting on Apple Watch  

Next, drag and drop an IBAction from the SMS button to the interface controller (as shown below).

Texting on Apple Watch  
Let’s name this IBAction onBtnSMS (as shown below)

Texting on Apple Watch

Next, in the onBtnSMS IBAction access the shared instance of WKExtension and name its method as openSystemUrl(“sms:”). The WKExtension object basically manages the behaviors that are shared among all of your app’s interface controllers. Every WatchKit extension has a single extension object that is created and managed by the system.

Texting on Apple Watch

Now, let’s compile and run the app on your Apple Watch. When you do that you’ll see the following screen.

Texting on Apple Watch

Just tap the SMS button to launch the messages app. You’ll notice that it already has a predefined number and text added to the message.

Texting on Apple Watch

Send out the text by pressing the Send button. And that’s it!

Explore our blog

ABOUT FOLIO3

As a leading mobile app development company (iPhone, Android, Windows Phone, HTML5 app development), Folio3 specializes in native app development services and cross platform mobile app development services for the iPhone and iPad. We also offer extensive mobile app testing and QA services. If you have a mobile app idea that you’d like to discuss please or would like to know more about our iPhone app development services, please Contact Us. Learn more about our iPhone, Android and Windows Phone app development services

CALL

USA408 365 4638

VISIT

1301 Shoreway Road, Suite 160,

Belmont, CA 94002

Contact us

Whether you are a large enterprise looking to augment your teams with experts resources or an SME looking to scale your business or a startup looking to build something.
We are your digital growth partner.

Tel: +1 408 365 4638
Support: +1 (408) 512 1812