Top iOS 9 SDK Features for Developers

September 28, 2015 Published by:

iOS9 SDK Features for Developers

The SDK accompanying iOS9 may not have as many features and functionality as were made available with iOS8. Remember, iOS8 had come with around 4000 APIs, and possessed some exciting and brand new features? Well, iOS9 may not have features in such huge numbers; nevertheless it has some excellent and new functionality that will help developers further their development strategies.

Let’s have a look at the new iOS9 SDK features that mean a lot to the developers.

Contacts API

iOS9 has come out with a new contacts API, which is an obvious replacement to the Addressbook framework that existed in the previous versions. The addressbook objects were not shared across threads, but in this case there is a partial thread safety. This a higher level API as against the addressbook framework which was based out of few opaque types like ABRecordRef

CNContact class is what puts together this API, and offers help in modifying the contact properties. With the existing CNContact, you can always create CNMutableContact, and this new mutable contact is not thread safe. The contact properties in this class are denoted by CNLabeledValue which is an immutable class. This property coupled with the tuple contact property allows you to use various labels associated with the contact like phone numbers, email, etc. There are many pre defined labels associated with the contact class like CNLabelHome, CNLabelEmailCloud and others that you need to associate with the contact.

The CNContactStore is the database of your contacts. It is thread safe class, like all others in iOS9 contacts API. You should ideally execute all the contact store methods along the background threads. If you have made any changes in the contact framework objects, then you will see the changes are made to the contact store.

Contacts UI

With iOS9, the new Contacts UI has been introduced which will replace the AddressBook framework UI which existed in iOS8 and previous versions. There are a few functionality that will be supported by this new UI, which include

  • CNContactPickerViewController: This will create a controller object that is responsible for contacts picker view
  • CNViewController: This will implement the view that will be used to display the contact
  • CNPickerDelegate: This will describe the interface used for this purpose
  • CNContactViewControllerDelegate: This will announce the interface that is to be used by the delegates

CoreSpotlight

This is Apple’s favorite and most concentrated upon feature for iOS9 SDK, specifically targeted towards developers. With this feature, apps will be able to integrate with the search functionality that is prevalent across the system. The content will be published either on spotlight or Siri reminders or Handoff. There is deep linking across the apps, which is why whenever the users tap on the search results, they will receive enough information on that particular content. Even app history can be implemented by this feature. Corespotlight is a feature that is spread across both native and web apps. Using a particular markup, you can ensure that your apps are allowed to be searched via spotlight.

Developers can use multitudes of classes to get the assured results. NSUserActivity class will help index the different activities and app states. With the new Corespotlight framework, you can index the app content, and enable the deep links for your content.

You will need to create an attribute set so that you can make the content searchable with corespotlight.

CSSearchableItemAttributeSet* attributeSet =
 [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage];
//
// Set properties that describe attributes of the item such as title, description, and image.
attributeSet.title = @"...";
attributeSet.contentDescription = @"...";

 

This attribute is then wrapped into CSSSearchableItem object which is known to contain a unique identifier along with a singular domain identifier. After this searchable item has been created, you can index it using the CSSSearchableIndex’s indexsearchableitemsmethod

 

// Create a searchable item, specifying its ID, associated domain,
// and the attribute set you created earlier.
CSSearchableItem *item;
item = [[CSSearchableItem alloc] initWithUniqueIdentifier:@"123456"
 domainIdentifier:@"domain1.subdomainA" attributeSet:attributeSet];
// Index the item.
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item]
 completionHandler: ^(NSError * __nullable error) {
 NSLog(@"Search item indexed");
}];

You can determine the reaction by implementing application:continueUserActivity:restorationHandler in the app delegate

(BOOL)application:(UIApplication *)application
 continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void(^)(NSArray *restorableObjects))restorationHandler {
 
 if ([[userActivity activityType] isEqualToString:CSSearchableItemActionType]) {
 // This activity represents an item indexed using Core Spotlight, so restore the context related to the unique identifier.
 // The unique identifier of the Core Spotlight item is set in the activity’s userInfo for the key CSSearchableItemActivityIdentifier.
 NSString *uniqueIdentifier = [activity.userInfo objectForKey:CSSearchableItemActivityIdentifier];
 }
}

Model I/O

If you want to handle 3D assets and data in your iOS9 SDK, then Model I/O is your best bet. With this, you get data structures that will aim at describing the physics of camera, meterials, light and ensure that all the data is easily accessible.

With Model I/O you can easily import and export the 3D asset files available in a wide range of formats. This model will help you ascertain that the right data is received and sent from your backend.

iOS9 has definitely offered enough traction to the developers such that they can offer strong footing in terms of data handling.

Semaphore Software is an Mobile App development company that offers customized iOS solutions. Get in touch with us via info@silvertouch.com to know more about our services.