UIActionSheet in iOS 8

UIActionSheet and UIActionSheetDelegate is deprecated in iOS 8. To create and manage action sheets in iOS 8 / later, we need to use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet because if we have used the same in our previous code it will simply not appear in iOS 8. Don't panic! It won't make a crash ;)
PFB - A quick adaptation for UIActionSheet/Delegate

UIView controls greyed out in iOS7

When opening and closing sheets and popovers in iOS7 the ui-controls like UISegmentedControl, UIProgressView, etc.
Its in the Apple's native app as well, where the bar button items become greyed, or conversely, they no longer turn to grey once a popover/viewcontroller shows up.

Its an open bug in iOS7, for quick fix we can manually set tintAdjustmentMode property of the effected UIView to UIViewTintAdjustmentModeNormal, e.g;
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(x, y, width, height)];
segmentedControl.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;

NOTE: This will prevent the color toggling in any case, i.e; there will be no effect of dimming when opening Popover/Sheet/ViewController

Handoff in iOS8

Handoff is all about making you work across all devices within proximity range. It uses BTLE (Bluetooth low energy or Bluetooth LE ) and iCloud account to pair devices. After pairing in iOS it display the current app icon in left corner of the lock screen, left side of home screen in multitasking switcher screen, On Mac it shows in right part of the dock and command + tab menu

Handoff supports live streaming between apps in two devices. Handoff works in between websites and apps as well.

Fundamental unit of handoff is an Activity (NSUserActivity). When we create an Activity it automatically brodcasts and shows up in paired devices. When user selects the Activity (i.e; select the app) the host is informed and asked for the detaled information, after that host sends the detailed package and the app get launched.

All applications from the same developer can exchange activities this is based on the team identifier. Applications don't have to claim;
  • the same activity type they create
  • any activity types, but can still create them
This is helpful when there are multiple apps in iOS for an app in OSX

Creating, Updating and Continuing Activity is supported by AppKit and UIKit, i.e; UIDocument, UIResponder now have a NSUserActivity property. In UIDocument based apps the activity is set in .plist and will be managed by OS itself. In UIResponder, when the app is in focus UIKit walks the view hierarchy and check for the Activity. Every time user focus the Activity it evokes the becomeCurrent method and invalidate when it finished. To manage user, Activity have userInfo property for minimal ammont of information. It is a dictonary and can store NSArray, NSData, NSDate, NSDictonary, NSNull, NSNumber, NSSet, NSString, NSUUID, NSURL..

UIApplicationDelegate have new method (i.e; application:continueUserActivity:restorationHandler:) which tells the delegate that the data for continuing an activity is available. This method have a optional block, restorationHandler which executes if your app creates or fetches objects to perform the task it must be called from the app’s main thread. restorationHandler has no return value and take restorableObjects as param which is an array of UIResponder or UIDocument objects representing objects you created or fetched in order to perform the operation.

When continued from another device NSUserActivityDelegate call userActivityWasContinued: which notifies the delegate that the user activity was continued on another device. This will helpful when more then two devices are paired and Handoff on the same app.

Extensions in iOS - Keynote

  1. Not all but most of the APIs are available for extesions
  2. Extensions have separate container for them which means they act like a saperate app for there parent app
  3. Extensions don't have access to their parent app data but can opt into data sharing
  4. Apps and Extensions can use a shared container/storage area which can be accessed at same time with the help of;
    • NSFileCordination - provides general syns strategy for app and extension
    • CoreData
    • sqilite
    • NSUserDefaults - with a shared suite name
    • Shared Keychains - for an app group
  5. Once user approve the Privacy access (e.g; Photos, Location..) to an app all its extensions don't need to ask saperately
  6. Extensions are stateless that means they are killed aggressively

Extensions configuration keys in .plist
  • NSExtension - A dictionary of keys and values that describe an app extension
    • NSExtensionPointIdentifier - Extension point’s reverse DNS name PFB
    • NSExtensionPrincipalClass - The name of the principal view controller class created by the template
    • NSExtensionAttributes - A dictionary of extension point–specific attributes that specify aspects of an app extension
      • further configuration based on extension kind

Values for the NSExtensionPointIdentifier key based on extension type;
  • Action Extension - com.apple.ui-services
  • Custom Keyboard Extension - com.apple.keyboard-service
  • Document Picker Extension - com.apple.fileprovider-ui
  • File Provider Extension - com.apple.fileprovider-nonui
  • Finder Sync Extension - com.apple.FinderSync
  • Photo Editing Extension - com.apple.photo-editing
  • Share Extension - com.apple.share-services
  • Today Extension - com.apple.widget-extension