iOS 7 Additions: OMG Finally!

Written by: on September 18, 2013

iOS 7 introduces some new, large additions to the developer’s toolbox. But there are also some smaller additions that really jump out and made us say “OMG Finally!”

1. Message UI Framework (attach files to messages)

We have always been able to use the MFMessageComposeViewController to allow the user to compose a text message. But up until now we could not attach an image. It’s almost hard to believe that this wasn’t possible before. The new method - (BOOL)addAttachmentData:(NSData *)attachmentData typeIdentifier:(NSString *)uti filename:(NSString *)filename; finally gives us that ability.

if ([MFMessageComposeViewController canSendText] && [MFMessageComposeViewController canSendAttachments] && [MFMessageComposeViewController isSupportedAttachmentUTI:(NSString *)kUTTypePNG]) {
    MFMessageComposeViewController *vc = [[MFMessageComposeViewController alloc] init];
    vc.messageComposeDelegate = self;
    vc.recipients = @[@"Yawkey"];
    UIImage *myImage = [UIImage imageNamed:@"Yawkey_business_dog.png"];
    BOOL attached = [vc addAttachmentData:UIImagePNGRepresentation(myImage) typeIdentifier:(NSString*)kUTTypePNG filename:@"Yawkey_business_dog.png"];
    if (attached) {
        NSLog(@"Attached (:");
    else {
        NSLog(@"Not attached ):");
    [self presentViewController:vc animated:YES completion:nil];


2. Media Player Framework (MPVolumeView – detect airplay and current airplay route)

MPVolumeView is the way for us to allow the user to interact with the AirPlay system. However, it has been difficult to get information on what the user has selected. There are two new properties and two new notifications that we can now use to get insight into the AirPlay system.

@property areWirelessRoutesAvailable;
@property isWirelessRouteActive;

These two properties allow us to know if there are any AirPlay capable devices available to the app and if any of them are already selected. Next up are the notifications.

NSString *const MPVolumeViewWirelessRoutesAvailableDidChangeNotification;
NSString *const MPVolumeViewWirelessRouteActiveDidChangeNotification;

These two notifications allow us to know when the availability of AirPlay routes has changed and when the user has changed the route currently in use.

OMG Finally!

3. AVFoundation (barcode scanner)

AVFoundation now comes with built-in support for detecting 1D and 2D barcodes. In the past if you wanted to use iOS to read barcodes or QR codes you needed to use a third-party library such as ZXing or ZBar. Now iOS 7 will output up to 4 machine readable codes for you. All you have to do is hook up an AVCaptureMetadataOutput to your AVCaptureSession. The AVCaptureMetadataOutput can be configured to detect any of these new types of machine readable codes.


Then, once you are set up as a AVCaptureMetadataOutputObjectsDelegate you can respond to the - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection; with all of the found codes.

Go exploring

These are just three examples of the new goodies that Apple has added to the already existing frameworks. You can find even more in the What’s New in iOS document provided by Apple.

This is the first in an 11-part Developer’s Guide to iOS 7. You can find the full guide here. For more information on how Double Encore can help you prepare your company for the changes in iOS 7, please email us.

Jay Graves

Jay Graves

Jay is the Chief Technology Officer for POSSIBLE Mobile, a leading mobile development company. Jay’s expertise developing apps for some of the world's top brands has made him a respected leader in the space, with his work being featured on television, in iTunes and on devices inside Apple retail stores.

Add your voice to the discussion: