Wednesday, 22 April 2015

IOS : Watch Kit

There are few links to give information about how to code for iWatch.

Function by which watch app communicate with iPhone app

# Write function in WKInterfaceController

WKInterfaceController.openParentApplication(param, reply: { (replyValues, error) -> Void in }

//param is value to send 
// replyValues is result which we get

# Write method in iOS app appDelegates

func application(application: UIApplication!, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]!, reply: (([NSObject : AnyObject]!) -> Void)!) {
    // retrieved parameters from Apple Watch

    // pass back values to Apple Watch
    var retValues = Dictionary<String,String>()

    retValues["retVal1"] = "return Test 1"
    retValues["retVal2"] = "return Test 2"


# Add group Id in Your app Provision Profile 

Going to Provision portal,identifiers->App IDs, your id, edit, app groups enable, edit set app group and save. Now go to provision profile and re-generate all the inactive Provision profiles and download them.

No comments:

Post a Comment