How to Add TextExpander Touch SDK to iPhone Apps

TextExpander Touch was released August 25th, 2009. Along with it, came an SDK to allow other iPhone apps to integrate it’s expanding feature. For users of TextExpander Touch, having this feature can be quite handy. There are quite a few apps like Tweetie 2 that feature TextExpander integration.

Adding TextExpander Touch support to your iPhone app is extremely easy. The SDK comes with a both a README file and a sample application to show how it came be done.

If you’re more of a visual person, here’s a step by step tutorial on how to add support.

Requirements

You’ll want to go ahead and head on over here to download the latest version of the SDK. Also, if you currently use TextExpander for the Mac, you’ll want to turn it off while testing in the iPhone Simulator, as things could get confusing.

Adding the SDK

  1. Copy the Device and Simulator Folders from the project into your XCode Project. You’ll want to make sure it creates the associated Groups so the 2 files don’t collide.
  2. Copy over SMTEDelegateController.h to your XCode project.
  3. Pick your XCode project (or Target app) and “Get Info” on it.
  4. Navigate to “Build” and make sure “All Configurations” is selected
  5. Click on “Library Search Paths” and then select “Add Build Setting Condition” from the Configuration at the bottom.
  6. Select “Any iPhone Simulator” and Add the following “$(SRCROOT)/Simulator”

  7. Repeat the same process for the “Any iPhone Device” and Add the following “$(SRCROOT)/Device”
  8. Set “Other Linker Flags” to: “-l teEngine”

  9. Finally, add the AddressBook and AudioToolkit frameworks to your project

Adding the Integration to UITextField and UITextView

  1. In your view’s .h header file add the following:
  2. #import “SMTEDelegateController.h”
  3. In your view’s .m implementation file add the following:
  4. Allocate and Initialize TE Touch Delegate, and assign them to UITextField and UITextView.
  5. And finally, take care of Memory Management by releasing your allocated items.

Notes

You will want to copy the “Defaults.textexpander” file to your XCode project for iPhone Simulator testing, but do make sure to remove it from your app when building for Device and Releasing to the App Store. Alternatively, you can keep it if you allow users to disable TextExpander expansions as a setting in your app.

You’ll get a compiling warning every time with the SDK added due to the Device linking. You can always remove the Device part and add it in later when you’re ready to test on a device or release the app.

Stay updated with the TE Touch SDK by sending them an email on their website and also by joining the Google Group for TE Touch SDK.

And as a final note, please don’t violate their license agreement. The SDK Read Me file contains explicit instructions on what needs to be listed in the Feature List for your app and in your About screen.

Will you be adding TextExpander Touch integration to your next app?

Leave a Reply

blog comments powered by Disqus