Monday, December 8, 2014

Apple's WatchKit and Kahwah



Yesterday one of my friend was preparing POC for a watchKit he called me and asked if I had done some thing on it. The most common stuff developers are busy now a days are notifications on iPhone being watched or responsed from iWatch.

I will explain few important things about watchkit. It give three offerings to developers what they can do from it as per Apple

1) WatchKit Apps. Your app on Apple Watch contains a full user interface. Users can launch, control, and interact with your app in ways unique to Apple Watch.

2)Glances. You can provide users with timely read-only information that they care about with a Glance — a quick and lightweight view of your app.

3)Actionable Notifications.Actionable notifications built and designed with WatchKit let users take action right from their wrists.



Creating a Watch App

A Watch app is the basis for interacting with your content on Apple Watch. Watch apps are accessible from the home screen and usually provide only a portion of the functionality of their containing iOS app. The purpose of a Watch app is to give the user quick but more in-depth access to app-related data.

How does it work? Let me explain this to you

How you build iPhone app similarly build watch app.
The watchkit app is managed by iPhone OS every app will have watchkit extension that will run on iPhone OS which will be responsible of all the activities from launching to the exit of the watch app. When user exits the watch app watchkit extension is suspened and dealloacted from the memory. It will be resonsible to provide necessary UI to watch app on iwatch.
The Watch app works in tandem with a corresponding WatchKit extension running on the user’s iPhone. The Watch app contains no custom code and is used only to store the storyboards and resource files associated with your user interface. The WatchKit extension is the brains of the operation. It contains the business logic and code you use to manage your content, respond to user interactions, and update your user interface. And because it runs on the user’s iPhone, the WatchKit extension can easily coordinate with your iOS app to gather location updates or perform other long-running tasks.


Customizing the Display of Notifications

Apple Watch works with its paired iPhone to display local and remote notifications. Initially, Apple Watch uses a minimal interface to display incoming notifications. When the user’s movement indicates a desire to see more information, the minimal interface changes to a more detailed interface displaying the contents of the notification. Apps can provide their own customized version of this detailed interface and add custom graphics or arrange the notification data differently than the default interface provided by the system.

Apple Watch supports the interactive notifications that were introduced in iOS 8. Interactive notifications are a way to add buttons to a notification that reflect immediate actions the user can take. For example, an incoming calendar event might include buttons to accept or reject a meeting invitation. When your iOS app registers support for interactive notifications, Apple Watch automatically adds appropriate buttons to both the custom and default notification interfaces. All you need to do is handle the actions selected by the user in your WatchKit extension.

There are guidelines for wachkit apps 

Apple watchkit Guidelines

After going much into watch kit I will give you a break and tell you how to refresh your mind when you are busy in doing some thing techincal. Here is Kashmiri Kahwah. From Wiki Wiki Kahwah

Kahwah (Urdu: قہوہ‎, also transliterated qehwa, kehwa or kahwa) is a traditional green tea preparation consumed in Afghanistan, northern Pakistan, some regions of Central Asia as well as theKashmir Valley. In Pakistan, it is made in the Khyber Pakhtunkhwa, Gilgit-Baltistan and north Punjab regions. It is a popular breakfast beverage among Kashmiris, generally accompanied with special Kashmiri baked items like girda. Kashmiri Pandit migrants living in the North Indian plains, particularly in the urban agglomeration of Delhi, have also contributed to the tea's popularity among non-Kashmiris.


How to prepare this kashmiri herbal Green tea.

Ingredients:
For one cup
Kashmiri Green Tea (Kahva) – 1/4 of tsp
Saffron – 1 pinches
Cardamoms – 1, slightly crushed
Almonds – 3, chopped
Cinnamon Stick – 1/2
Clove – 1/2
Sugar or Honey – 1 tblsp

Method:
1. Boil 1 cup of water along with cinnamon, cardamom and cloves.
2. Add in the Kahva.
3. Let it simmer in low flame for 10 minutes.
4. Meanwhile, dissolve saffron in a teaspoon of water.
5.  when you see brown golden color appearing strain the tea and add the saffron liquid together with crushed almonds.
6. Sweeten with sugar or honey as required to taste.

Sip the tea and come back to the work. Let us finish this iwatch Sample series continued in next post stay tuned. 


Friday, November 28, 2014

As I was going through some stuff I have not come across these things but may be I will see them soon 10 known OS X yosemite issues 10.10.1

If you are good at troubleshooting yourself then these 10 items may help you. 

Saturday, November 22, 2014

It was a quite long time when I am posting something new I was recently working on deploying the apps through TestFlight.  How can we deploy the apps for external and internal users.

How to Add testers

Log into iTunes connect

Create a new application upload the app to iTunes

Under Prerelease you can add the external email Id

When email is checked in iTunes connect under Prerelease an invitation is send to the user

In iTunes Manage Accounts the user you invite for internal testing role can also be seen under Prerelease you can check on/off the users whom you want to invite.  Limit for internal testers 25 per account

When you are done with internal testing now it is time for beta testing add beta tester by adding emails addresses, limit to beta testers is 1000 per account

Testing invitation expires after 30 days

When users downloads the app from invitation you can see that from iTunes Connect


FAQ on TestFlight

When user receives an invitation from email if TestFlight app is not there it takes the user to app store to download the app.

Install app on iOS device

User should have the TestFlight app

TestFlight app open the link from received email and shows  an option to download the beta app for testing.

User can click on install app from TestFlight

If there is a new version available to the app it will overwrite the version you have in device.

If user has live version and you receive an invitation for the same app for beta testing it will update the your live app to beta and vice versa

This is how testFlight works with Apple

TestFlight is acquired by Apple but if it also works as it used to be you can visit the TestFlight site register with them and create apps there for deployment but those will not work with iTunes. 

Limitations: TestFlight with iTunes can work for Appstore deployments

If you want to share apps for Enterprise you can directly create account with TestFlight this has no relation with iTunesConnect






Saturday, November 26, 2011

extern variable in iPhoneSDK 5.0

extern or global variable

Create a new project,

Create extern variable in the header class
extern NSString *myexternalString;

in the implementation file define it at the top
NSString *myexternalString;

Now extern variable is ready you can set the value and use it in any other class you just have to import the header before using it in other classes.


here is the sample code

Zooming UIImageView in iOS 5.0

Create a new project using xcode 4.0 with runtime iOS 5.0.

Suppose you have created view based project.

In root view controller class.

Add UIScrollView in xib and connect outlet to root ViewController.
Add UIImageView as subview on xib and connect its outlet to root ViewController OR create it writing code in root ViewController class and add subView to ScrollView.

Add UITapGestureRecognizer to UIImageView instance for single double taps and two finger touches.

set the UIScrollView's scale

// calculate minimum scale to perfectly fit image width, and begin at that scale
float minimumScale = [scrollView frame].size.width / [imageView frame].size.width;
scrollView.maximumZoomScale = 1.0;
scrollView.minimumZoomScale = minimumScale;
scrollView.zoomScale = minimumScale;

//note set the imageView's frame in ViewwillAppear or ViewDidAppear.
imageView.frame = CGRectMake(0,0, 320, 480);

when tap occurs at imageView, calculate the rect and set the rect to scroll view.
[scrollView zoomToRect:zoomRect animated:YES];


here is the sample code

Thursday, October 13, 2011

Automatic Reference Counting

ARC seems to be a great feature.

I found some useful links to know more about that

ARC Apple Docs
ARC

How to Add Frame work in Xcode 4 and ios 5.0

1. Select the project on top at left side.
2. Select Targets




3. under Link Binary with Libraries, click on + that will open a list and select the frame work from that list.