Thursday, June 16, 2016

Siri and Maps interact with your app’s services through two different types of extensions:

To support SiriKit, you use the Intents framework and Intents UI framework to implement one or more extensions that you then include inside your iOS app.

We can add SiriKit if and only if app supports any of the following. These are called domains.

Audio or video calling
Messaging
Payments
Searching photos
Workouts
Ride booking

Siri and Maps interact with your app’s services through two different types of extensions:

An Intents extension communicates your app’s content to Siri and Maps and performs the tasks associated with any supported intents.
An Intents UI extension provides a custom interface for your content within the Siri or Maps interface. This extension is optional.

Siri handles the language processing and semantic analysis needed to turn the user’s spoken requests into actionable intents that your extensions can handle. Siri and the Maps app manage all user interactions and display the results to the user using a standard system interface. Your role is primarily to provide the data to display. If your app includes an Intents UI extension, you can also provide a custom interface to supplement the default system interface.

Ride booking and restaurant reservations are handled primarily by the Maps app, although users can also book rides using Siri. Your Intents extension handles interactions that originate from the Maps app in the same way it handles requests coming from Siri. If you customize the user interface, your Intents UI extension can configure itself differently depending on whether the request came from Siri or Maps.

Creating intents extension

The entry point of your Intents extension is the INExtension object, whose sole job is to direct Siri to the objects capable of responding to user requests. When implementing an Intents extensions, there are three types of objects that you use regularly:

An intent object defines the user’s intent and contains the data that Siri gathered from the user.
A handler object is a custom object that you define and use to resolve, confirm, and handle an intent.
A response object is a data object containing your response to an intent.
When there is an intent for your extension to handle, Siri asks your INExtension object for an object capable of handling that intent. A handler object can be any type that you want, but it must implement the specific methods needed to handle the given intent. Each intent has an associated protocol that its handler must adopt. The methods of this protocol are divided into three groups: resolution methods, confirmation methods, and handling methods. We need to implement the methods you need and provide Siri with information about how you plan to handle the intent.

references:

https://developer.apple.com/library/prerelease/content/documentation/Intents/Conceptual/SiriIntegrationGuide/index.html

Wednesday, June 15, 2016

iOS 10 few new features overview

Apple TV remote app

this is an app on users iPhone with the same capabilities as the Siri remote.
The app uses touch, voice to control Siri, and motion controls for playing games. You can enter text with the regular keyboard.

Another new feature bridging the gap between tvOS and iOS is the automatic download of apps across your devices. Download, for example, the MLB app on your iPhone and it automatically gets installed on your Apple TV as well.

Extending its Continuity effort to make it easier to work across Apple devices, the company also introduced a new Universal Clipboard, which was greeted with exuberant whoops and cheers. Basically, snippets of text, hyperlinks, and the like that you copy on one iOS or macOS device will be available on all the others

 A new "Raise to wake" feature will, as the name suggests, wake the phone's lock screen when it's lifted to give you an overview of notifications and updates. The new notifications look significantly different and, with the use of a 3D Touch, you can respond to and interact with the app sending them immediately. This is very much in line with what Google's been doing with Android.

 The expansion of 3D Touch on the home screen includes widgets for apps that don't require you launching the app at all. You'll be able to see things like the latest sports scores with the ESPN app, and even get into video highlights, without entering the app proper.

- Apple is opening up Siri to developers. Now you'll be able to ask things like "send a WeChat to Nancy saying I'll be five minutes late." That brings up an interface to interact with WeChat directly. Supported apps already include Slack, WeChat, and WhatsApp for communication, as well as Uber, Didi in China, Runtastic, Runkeeper, MapMyRun, and Skype (among others) for VoIP calls.

- Siri now has more contextual awareness. It makes intelligent suggestions based on your current location, calendar availability, contact information, recent addresses, and more. It's Siri growing more and more into the role of an AI or a bot. And yes, it's based on deep learning just like Google's rival system is.

Also based on deep learning is a major update to the Photos app that adds new object and scene detection for powerful search and sorting on your device. All the AI is local to the device, Apple is keen to stress. The phone will cluster together photos that are most relevant at any moment — trips, photos of the last weekend or last year. It can then automatically edit together highlight reels of particular trips or events. It's just like HTC's Zoe photos

Apple Maps is getting an all-new design in iOS. Eddy Cue says the new Maps is "a lot more proactive." Rather like Siri and Photos already are: a lot more predictive stuff being introduced. Maps, like Siri, is being opened up to developers, who can now make use of its extensions. That will allow you to book and pay for a restaurant, book and pay for a Uber ride, and then track your ride, all without leaving the Maps app.

Apple Music is also getting in on the refresh fun with "a redesign from the ground up." Eddy Cue says the new, simpler interface makes the music king, implicitly acknowledging that the old UI was a tiny bit convoluted

Apple Home is the first major all-new app today. It builds on Apple's HomeKit infrastructure to let you manage and control all your connected and compatible accessories around the home. HomeKit is now also built right into Apple's swipe-up Control Center, so it can be accessed even from your iPhone's lock screen. 

The Phone app on the iPhone is also evolving, In iOS 10, it will have voicemail transcriptions so that you can see what messages have been received without having to listen to them. Additionally, the app can now detect when an unknown caller is potentially phone spam and will label those calls as such.


- Messages is the most frequently used app on iOS. It's getting rich links in the new iOS version, allowing things like videos to play right in line inside the message. Emoji have been made three times bigger and, much to the crowd's delight, Apple is going to highlight "emojifiable" words, which you'll be able to just tap and automatically turn into emoji.Messages is also getting bubble effects, which are just cute animations when displaying messages. Apple Music is integrated into Messages — can play a track right in line. And just like Maps and Siri, Messages are being opened up to developers with iMessage apps


references:

Sunday, June 12, 2016

UIImagePickerController - why does it show black area at the bottom?

The reason for this is because the aspect ratio of camera and the screen is different. for e.g. 4:3 while of the screen is 3:2. To fill in the screen, the picture from camera needs to be cropped to the aspect ratio of screen. To dynamically compute it, below is the code.


    self.picker = [[UIImagePickerController alloc] init];
    self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
    self.picker.showsCameraControls = NO;
    self.picker.navigationBarHidden = YES;
    self.picker.toolbarHidden = YES;
   self.picker.cameraViewTransform = CGAffineTransformMakeTranslation(0, (screenBounds.height - camViewHeight) / 2.0);
    self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, scale, scale);

    

references:
http://stackoverflow.com/questions/2674375/uiimagepickercontroller-doesnt-fill-screen

Wednesday, June 1, 2016

Why Does the Apple Watch App Fails to launch on the real hardware?

A lot of threads about this and below is my finding

First of all, the OS version on the Watch was 2.0 and the Xcode was supporting 2.1 OS version. Now, by default the Watchkit App target will be created with the Deployment target as 2.1. If forget about this and try to install the app on the hardware, it will fail to install complaining the version number. Go ahead and change it only in the Watch App deployment target to 2.0 and it will get installed successfully on the device. Now try to launch, it will keep spinning forever. Come back to the Xcode and change the deployment target of the Extension to 2.0 and again install and try to launch. Yep, That launches the app successfully with the interface controller shown.

It was just about the deployment target that caused this issue for me.

references:
http://stackoverflow.com/questions/31489920/apple-watch-app-stuck-loading-shows-a-spinning-wheel-on-real-device

iOS How to code sign without paid account?

We need to first enroll so that get a non paid personal ID https://developer.apple.com/programs/enroll/ 
Once enrolled, This can be give in the accounts area in the Xcode app under preferences. With this done, 
trying to login again will let one to install the app on the device. However, first time the launch will fail because it is not trusted yet.
Trust the profile under settings and now we can launch the app and debug directly on the device. 

Seven years after the inception of the App Store, Apple has finally introduced the new version of Xcode, Xcode 7, which will allow you to deploy and run any number of apps on any of your devices, simply by logging in with your Apple ID. You will no longer need a paid Program membership (and you certainly no longer have to jailbreak your device if you're not comfortable doing so).

Well, not for the majority of use cases anyway. For obvious reasons, certain capabilities and entitlements that require Program membership such as Game Center and in-app purchases will not be available to apps deployed using this method. From Apple's developer documentation:
                                                                                                                                                                    Launch Your App on Devices Using Free Provisioning (iOS, watchOS)

If you don’t join the Apple Developer Program, you can still build and run your app on your devices using free provisioning. However, the capabilities available to your app, described in Adding Capabilities, are restricted when you don’t belong to the Apple Developer Program.
                                                                                                                                                                    The precise steps to getting your app onto your iOS device or Apple Watch follow immediately thus (screenshots omitted for ease of skimming):

In Xcode, add your Apple ID to Accounts preferences, described in Adding Your Apple ID Account in Xcode.

In the project navigator, select the project and your target to display the project editor.
                                                                                                                                                                    Click General and choose your name from the Team pop-up menu.Connect the device to your Mac and choose your device from the Scheme toolbar menu.

Below the Team pop-up menu, click Fix Issue.

 Xcode creates a free provisioning profile for you and the warning text under the Team pop-up menu disappears.

Click the Run button.

Xcode installs the app on the device before launching the app.

Prior to Xcode 7, a Program membership was indeed required in order to sign the provisioning certificates required to deploy apps to devices. The only other alternative was jailbreaking. With Xcode 7, you no longer need to jailbreak your device just to run apps distributed outside the App Store, or to test apps if you cannot afford to join the Program, or to deploy and use apps that you have developed for your own personal use if you do not intend to distribute them through the App Store (in which case you probably don't need the entitlements offered by Program membership anyway).


reference: