phpqic9ly
WWDC

Apple has recently announces WWDC 2017, and being Apple Developer myself this is the news that really exits me. I receive email from apple as a part of Apple Developers program. Below is the exact line which seems really thrilling me.

Technology alone is not enough.
Technology must intersect with the liberal arts and the humanities, to create new ideas and experiences that push society forward. This summer we bring together thousands of brilliant minds representing many diverse perspectives, passions, and talents to help us change the world.

On last WWDC 2016 apple announced iOS 10, watchOS 3, Swift 3 and TVOS which was really exiting. So any guesses whats in for 2017 ? Well before going into that rumours first things first :

When & where is WWDC 2017 ?

wwdc 2017 convention San jose
wwdc 2017 convention San jose

Well this year WWDC will be held from 5th June to 9th June 2017. And this time it will be in the McEnery Convention Center in the city, i.e. in San Jose, rather than the usually city of San Francisco.

What about Tickets & price ?

Apple has not officially announces anything here for ticket prices but it is expected to be somewhere around $1599 & they will be distributed through lottery systems. But it comes with few conditions, where the person willing to buy ticket should be member of Apple Developer program. And its registration process is expected to start from 27th March.

What to Expect from WWDC 2017 ?

wwdc_event_action

Well its is humoured that Apple will make couple of announcements as below :

  • MacOS 10.13

Well this will sound too obvious as in every WWDC event apple has announced its new Mac OS, thus at this WWDC is also we expect that apple will announce mac os 10.13. Apple long ago stopped naming its desktop operating systems after big cats. It’s since moved onto California locations like Yosemite, El Capitan and Sierra. And this year we expect the OS name to be wine or fruit-themed codename. :P. Going on the features it is assumed to have

  • APFS File system
  • More smarter Siri
  • Homekit & HealthKit features
  • Dedicated Music app
  • iMessage

Well this is just the rumours going on. We will find out authenticity of the news at WWDC 2017 only 😛

  • iOS 11
iOS 11
iOS 11

iOS 11, well with every new iOS we experience the iPhones to be having some or the other issues and can we expect this year not to follow the tradition ? We expect atleast two new iPhone models this year. And if we go with the prediction it will have 7S & 7S Plus. But if we go with rumours we expect launch of iPhone 8. And it is also rumoured that iPhone 8 will have touch bar similar to Macbook Pro.

iOS 11 seems to have revamp keyboard as we heard the news that Apple was granted a patent in November that mentions a dynamic keyboard positioning for touch screens. The patent describes a concept in which typing “is improved by dynamically and automatically positioning the desired home-row keys of an onscreen keyboard below the user’s fingers while their fingers are hovering above the surface, thus reducing the need for the user to look at the onscreen keyboard while typing”. So fingers crossed for iOS 11 & iPhone 8.

  • iMessage

There was major updates on iMessage in iOS 11 and it is being loved by many of the iPhone users. I personally love the Heartbit, Love & kiss gesture on iMessage. So what next in messaging ? Well what if we say apple will bring iMessage to android message ? Well apple is planning to bring up iMessage app to android users. That sounds exiting dont it ? There are major updates expected in iOS 11 for iMessage and we do also expect this time apple to launch a new messaging app as well.

  • WatchOS 4
watch OS4
wwdc 2017 watch os4

Apple watch has been evolving greatly since couple of years and this year we expect watchOS to have major update. We expect Track your sleep feature as part of this update. Also it is expected that watchOS4 will announce the developer apps for watch faces. That will open up a whole new dimension for developers

  • TVOS 11
TVOS 4
TVOS 4

As a developer i didn’t got chance to explore the new TVOS. This time it is humoured that wish list feature will include 4K support, Dolby Atmos support, Safari for Apple TV, Home app for Apple TV, “Hey Siri” voice activation

See you all in WWDC 2017, till than happy coding folks :)

 

multipeer1
Uncategorized

Hey Folks,

I have been recently exploring the Multipeer connectivity framework iOS and i thought sharing the same would be really helpful for those who have unexplored this framework.

Well First things first. Few questions & answers :

  • Why use Multipeer connectivity ?
    • If you are looking forward for connecting two or more iPhones via bluetooth or wifi and that need file sharing or needs something like chat application, you are on right track
  • What is Multipeer ?
    • Multipeer framework is build for iPhone to connect peripheral devices, We can use it to connect to iPhones, iWatch, iBeacons and other bluetooth accessories too. Its basic framework that defines protocol for peer to peer connections

Enough talking, lets dig into coding part.

Pre-requisite for implementing peer to peer connectivity.

  • iPhone (Physical Device)
  • Simulator OR another iPhone or Bluetooth peripheral devices
  • Basic overview of Peer commands and full understanding of sending bytes in packets through encryptions. (Lolz just kidding)

So lets Start.

Step 1 : Add Multipeer Connectivity Framework

Screen Shot 2016-06-17 at 9.10.09 PM

Step 2 : Create two files Master & Slave

Also download Multipeer this 2 files

Master would be searching for another device & slave would advertise itself that i am available for connection. (Same like Groom/Bride Searching :P).

So here is code for Master :

#import <MultipeerConnectivity/MultipeerConnectivity.h>
@import MultipeerConnectivity;
@interface MasterVC : UIViewController <MCBrowserViewControllerDelegate>
- (IBAction)browseForDevices:(id)sender;
@end

For Master.m

// in your appdelegate

@property (nonatomic, strong) MPManager *mpManager;

_mpManager = [[MPManager alloc] init];

// In your master.m

- (IBAction)browseForDevices:(id)sender {
    [[_appDelegate mpManager] setupMCBrowser];
    [[[_appDelegate mpManager] browser] setDelegate:self];
    [self presentViewController:[[_appDelegate mpManager] browser] animated:YES completion:nil];
}

- (void)viewDidLoad {
    [super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(didStartReceivingResourceWithNotification:)
                                                 name:@"MCDidStartReceivingResourceNotification"
                                               object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(updateReceivingProgressWithNotification:)
                                                 name:@"MCReceivingProgressNotification"
                                               object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(didFinishReceivingResourceWithNotification:)
                                                 name:@"didFinishReceivingResourceNotification"
                                               object:nil];
}

#pragma mark - Public method implementation

- (IBAction)browseForDevices:(id)sender {
    [[_appDelegate mpManager] setupMCBrowser];
    [[[_appDelegate mpManager] browser] setDelegate:self];
    [self presentViewController:[[_appDelegate mpManager] browser] animated:YES completion:nil];
}


#pragma mark - MCBrowserViewControllerDelegate method implementation

-(void)browserViewControllerDidFinish:(MCBrowserViewController *)browserViewController{
    [_appDelegate.mpManager.browser dismissViewControllerAnimated:YES completion:nil];
    [_tblConnectedDevices reloadData];
}


-(void)browserViewControllerWasCancelled:(MCBrowserViewController *)browserViewController{
    [_appDelegate.mpManager.browser dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - Private method implementation

-(void)peerDidChangeStateWithNotification:(NSNotification *)notification{
    MCPeerID *peerID = [[notification userInfo] objectForKey:@"peerID"];
    NSString *peerDisplayName = peerID.displayName;
    MCSessionState state = [[[notification userInfo] objectForKey:@"state"] intValue];
    
    if (state != MCSessionStateConnecting) {
        if (state == MCSessionStateConnected) {
            [_arrConnectedDevices addObject:peerDisplayName];
        }
        else if (state == MCSessionStateNotConnected){
            if ([_arrConnectedDevices count] > 0) {
                @try {
                    int indexOfPeer = [_arrConnectedDevices indexOfObject:peerDisplayName];
                    [_arrConnectedDevices removeObjectAtIndex:indexOfPeer];
                } @catch (NSException *exception) {
                    
                } @finally {
                    
                }
                
            }
        }
        [_tblConnectedDevices reloadData];
        
        BOOL peersExist = ([[_appDelegate.mpManager.session connectedPeers] count] == 0);
    }
}

And For Slave

- (void)viewDidLoad {
    [super viewDidLoad];
    _appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [[_appDelegate mpManager] setupPeerAndSessionWithDisplayName:[UIDevice currentDevice].name];
    [[_appDelegate mpManager] advertiseSelf:YES];
}

-(void)didStartReceivingResourceWithNotification:(NSNotification *)notification{


}
-(void)didFinishReceivingResourceWithNotification:(NSNotification *)notification{

}

Step 3 : Send Data to Slave Device

NSData *dataToSend = [@"play" dataUsingEncoding:NSUTF8StringEncoding];
    NSArray *allPeers = _appDelegate.mpManager.session.connectedPeers;
    NSError *error;
    
    [_appDelegate.mpManager.session sendData:dataToSend
                                     toPeers:allPeers
                                    withMode:MCSessionSendDataReliable
                                       error:&error];

Step 4 : Test & Debug :)

Happy Multipeering. Feel free to contact me.

cordova
Uncategorized

Hey Folks,

Hope you are enjoying the tech post from my blogs, Few days ago i got opportunity to develop the Bluetooth TSL SDK’s Hand held Scanner Cordova plugin for iPhone. And that was exiting work for me. So i decided to write a blog which will show you how can we actually develop a Simple Cordova/PhoneGap plugin in iOS.

This will be very simple yet effective blog. Before moving ahead please keep in mind following pre-requisites.

  • xCode & iPhone Application Knowledge
  • Basic Knowledge of Cordova/PhoneGap
  • NodeJS installed on your MAC
  • Cordova installed on your MAC
  • Basic Knowledge of JavaScript & HTML

So lets dive into our first PhoneGAP / Cordova Plugin development. So here is the basic understanding of why do we need phonegap/cordova plugins and how can we bridge between them.

So Whats the Plugin ? Well Cordova/ PhoneGap is sued for developing hybrid application through extensive use of HTML & JavaScripts. And this apps can be easily deployed into various platforms like iPhone, Android, Windows, Blackberry and many more. But for accessing device hardware specific functionality PhoneGap/Cordova has created Plugins which can convert the JavaScript function call into iPhone/Android/Windows/Blackberry SDK calls.

So we will be learning this today. So lets deep dive into the coding

Step 1 : Create Cordova Project

cordova create plugin com.plugin Plugin
cd plugin/

Step 2 : Add iOS Platform

cordova platform add iOS

Step 3 : Adding Your Plugin into Config.xml

<!-- My custom plugin Start -->

    <feature name="MyResult">

        <param name="ios-package" value="MyResult" />

    </feature>

 <!-- My custom plugin End -->

Step 4 : Creating MyResult.h & MyResult.m classes

Here we need to inherit ‘CDVPlugin’ class into our MyResult.h

#import <Foundation/Foundation.h>
#import <Cordova/CDV.h>
@interface MyResult : CDVPlugin
// This will return the file contents in a JSON object via the getFileContents utility method
- (void) calcMe:(CDVInvokedUrlCommand *)command;

@end
#import "MyResult.h"

@implementation MyResult
-(void)calcMe:(CDVInvokedUrlCommand *)command{
    NSDictionary *jsonObj = [ [NSDictionary alloc]
                             initWithObjects:@[@"10" ] forKeys:@[@"result" ]
                             ];
    
    CDVPluginResult *pluginResult = [ CDVPluginResult
                                     resultWithStatus    : CDVCommandStatus_OK
                                     messageAsDictionary : jsonObj
                                     ];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end

Step 5 : Writing JavaScripts

Here we can call the calcMe function of our MyResult.h class through this syntax of

Cordova cordova.exec(success function, Failure function,Class Name,Function name,Arguments);

 onDeviceReady: function() {
        app.receivedEvent('deviceready');
        app.getReults();
    },

getReults: function(){
        cordova.exec(
                     function callback(data){
                        alert(data.result);
                     },
                     function errorHandler(err) {
                        alert('Error');
                     },
                     'MyResult',
                      'calcMe',
                     []
        );
    }

And your Final index.js file will look like below

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
        app.getReults();
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
    },
    // Calling our own function
    getReults: function(){
        cordova.exec(
                     function callback(data){
                        alert(data.result);
                     },
                     function errorHandler(err) {
                        alert('Error');
                     },
                     'MyResult',
                      'calcMe',
                     []
        );
    }
};

app.initialize();

Step 6 : You are now Cordova/PhoneGap Developer : Cheers :)

You can download plugin from plugin.

Hope you have enjoyed this tutorial. There is more coming up stay tuned.

icloud-intro
Uncategorized

Have you been wondering how to actually integrate the iCloud storage in your Application ? Here is quick, short yet effective tutorial for the new bee.

Why Do we need iCloud Storage in my app :

  • Do you need to restore the data of the user even if user uninstalls your app ?
  • Do you want the user to logged into the application through different devices yet the data should be sync without web service ?
  • Do you want to store small bunch of data without creating web services ?

If the answers to above question is affirmative than feel free to integrate iCloud and follow this sort yet effective tutorial

Pre-requisite (A big hurdle) :

To integrate iCloud into your application you will need

  1. Apple Developer Account (Paid Account :P)
  2. Developer Certificate
  3. Bundle ID with iCloud Enabled
  4. Provisioning Profile with Above Certificate & Bundle ID
  5. Actual device to Test the APP

Notes : I would not prefer to use Wild Card Bundle ID & provisioning Profile to integrate iCloud/

Steps :

  1. Creating the Bundle Identifier :

    Screen Shot 2015-07-28 at 2.43.13 pm

    Screen Shot 2015-07-28 at 2.43.23 pm

    You will need to enable the iCloud in Your bundle identifier that will be needed.

  2. Setting up the basic application

    So you have set up the bundle ID, you are having the certificates and you have the provisioning profile with above certificates and bundle id. That means we can get our hand dirty into iCloud Application coding. Lets start with the basic setup. Follow the below screenshot to setup the basic app.

    1) Select the target-> general and check if cloudKit.framework is included as per below screenshot :

    Screen Shot 2015-07-28 at 4.55.32 pm

    2) Select target-> Category and enable iCloud -> KeyValue Storage And check if All 4 steps are tick if not like below screenshot click on Fix issue. (You will need team to be added in order to fix this issues)

    Screen Shot 2015-07-28 at 4.55.49 pm

    3) Check if Entitlement File is created and setup which will look like below :

    Screen Shot 2015-07-28 at 4.56.39 pm

  3. Writing the actual Code

    I hope you have followed me till now. Now lets dive deep into coding part. And its not complicated :P. I hope you are aware of NSUserDefaults. This syntax is similar to that and you will enjoy coding for iCloud.

    Lets look at the functions below :

    @property (strong, nonatomic) NSMutableArray *notes;
    
    - (NSArray *)notes
    {
        if (_notes) {
            return _notes;
        } 
        _notes = [[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:@"AVAILABLE_NOTES"] mutableCopy];
        if (!_notes) _notes = [NSMutableArray array];
        return _notes;
    }
    
    
    -(IBAction)writeToiCloud:(id)sender
    
    {
        _notes = [[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:@"AVAILABLE_NOTES"] mutableCopy];
        if(!_notes)
        {
            _notes=[[NSMutableArray alloc] init];
        }
        
        [_notes addObject:@"test1"];
        [[NSUbiquitousKeyValueStore defaultStore] setArray:self.notes forKey:@"AVAILABLE_NOTES"];
    }
    -(IBAction)readFromiCloud:(id)sender
    
    {
        _notes=[[NSMutableArray alloc] init];
        [[NSUbiquitousKeyValueStore defaultStore] synchronize];
       _notes = [[[NSUbiquitousKeyValueStore defaultStore] arrayForKey:@"AVAILABLE_NOTES"] mutableCopy];
        NSLog(@"%@",[self.notes description]);
        UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Array data" message:[NSString stringWithFormat:@"%@",_notes] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];
    }

    Here NSUbiquitousKeyValueStore actually is used to perform iCloud Read/Write Operations. Do not forget to bind this to touchUpInside event of Button.

  4. Testing Your App.

    Install into your device click on write button, read button Close App. UnInstall the app. Re-install the app and than perform Read operation if you are able to read you are iCloud Master 😛

ios-9-download
Uncategorized

Multitasking Enhancements for iPAD

For Multitasking on iPAD, iOS 9 has introduced bunch of new views which are :

  • Slide Overview : Talking about Slide view, it lets users pick a secondary app and quickly interact with it
  • Split View : It provides users the ability to use two apps side by side on iPad Air 2
  • Picture in Picture View : (also known as PiP) lets users watch video in a window that floats above other onscreen apps.

3D Touch

3D Touch is all new exiting feature of iOS9, this will change the way we use the touch gesture. On supported devices, people can quickly choose app-specific actions from the Home screen by pressing on the app icon. Within an app, people can use various pressures to get a preview of an item, open the item in a separate view, and access related actions

Search

This is all new exiting feature where in the User can search within app, even news. This will definitely eliminate need of Google. Search in iOS 9 gives users great new ways to access information inside of your app, even when it isn’t installed. When you make your content searchable, users can access activities and content deep within your app through Spotlight and Safari search results, Handoff, and Siri suggestions.

Gaming

Gaming is taken to all new level in iOS 9. There are minor improvisations on Gaming but will help the developers to create new and exiting games. iOS9 includes several technology improvements that make it easier than ever to implement your game’s graphics and audio features. Take advantage of high-level frameworks for ease-of-development, or use new low-level enhancements to harness the power of the GPU.

App Thinning

I have already written a brief blog on App Thinning which you can find it here. This feature will help to reduce the application size to a big extend.

Support for Right to Left Languages

iOS 9 brings comprehensive support for right-to-left languages, which makes it easier for you to provide a flipped user interface. This feature will help developer to create actual multilingual application

App Transport Security

App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11.

iosdev
Uncategorized

So today I decided to start the blog with this first note of TOP 10 must have library to be included in your next iOS project. I wish i could have read this post before starting my next project. Anyways to cut it short below is the list of top 11 library which i would want you to use in your next project

  1. AFNetworking
    AfNetworking is one of the most popular third party library that most of the developers prefer to use. The main reason that i prefer to use AFNetworking is its easy & provides completion blocks.
  2. MBProgress HUD
    MBProgress HUD is the loading indicator which is popular amongst the developers. Again its easy on syntax and looks great :)
  3. GCDiscreetNotificationView This is very similar to android Toast message and its userfull to convey any message to user without having user interactions
  4. EGOTableViewPullRefresh
    Most of the application now use the Pull to refresh feature and if you wish to make your coding easy i will recommend to use this plugin
  5. ShareKit
    Every application will have the Share to FB, Twitter, LinkedInn functionality and you can achieve this very easily through this third party plugin. Its very popular amongst developer
  6. REFrosted Menu
    REFrosted Menu is very sweet on eyes and easy on coding part. Also customising this menu is dam easy. I will recommend this to all my fellow developers
  7. SDImageView
    For the new bee developers Image caching and loading is a big headache and this is the perfect medicine for them to recover 😛
  8. IQKeyboardManager

    IQKeyboard adds next previous buttons to the textfield automatically without writing single line of code and it will handle the scroll automatically.

  9. Action sheet Picker Control

    Action sheet picker is another easy way to load the picker view in action sheet

  10. Rating Controller

    Sometimes we need to add rating control in our project this library comes handy

  11. JDFPeekaboo

    Facebook app hides the header bar as we scroll down and shows it as we scroll up. If you need same functionality this is the library that you are looking forward.

self_sizing_cells_cell
Uncategorized

Hey Readers,

Its been quite a while since i have not written any of the blogs, and today i came across classic iOS development issues so i decided to write a blog for the same.

How to make tableview cell adopt the text height ? There are many places where we need tableview’s cell to adopt the size of the text that might be coming either from web services or from other data source. So how do we do that ?

For implementing Autosizing table view we need to follow these steps 

Step 1 : 

Set following properties on tableview

self.tableView.rowHeight = UITableViewAutomaticDimension;

Step 2 : 

Calculate height for Tableview, for this we need to take our cell’s label’s, textfields and buttons and other elements who will have dynamic heights and we need to calculate their height which is done below by calling heightNeededForText for each of the label, button, textfield and other elements.

-(CGFloat)calculaeHeightForTableViewCell:(CellArticle *)sizingCell{

    CGFloat tmpheight=[self heightNeededForText:sizingCell.txtDesc.text withFont:[UIFont fontWithName:@"Helvetica Neue" size:14.0] width:sizingCell.frame.size.width lineBreakMode:NSLineBreakByWordWrapping] + [self heightNeededForText:sizingCell.txtTitle.text withFont:[UIFont fontWithName:@"Helvetica Neue" size:14.0] width:sizingCell.frame.size.width lineBreakMode:NSLineBreakByWordWrapping];

    CGFloat tmph=MAX(tmpheight, 110);

    CGSize size = CGSizeMake(sizingCell.frame.size.width, tmph);

    NSLog(@"%f",size.height);

    return size.height + 10.0;

    

}

- (CGFloat)heightNeededForText:(NSString *)text withFont:(UIFont *)font width:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode {

    NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];

                       paragraphStyle.lineBreakMode = lineBreakMode;

    CGSize size = [text boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)

                                                        options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading)

                                                     attributes:@{ NSFontAttributeName: font, NSParagraphStyleAttributeName: paragraphStyle }

                                                        context:nil].size;

                       

    return ceilf(size.height);

}

Step 3 : 

Run the code and you are done.

Hope this helps.

quick_action
Uncategorized

Hey Folks,

iPhone 6s & iPhone 6S plus are in the market now, so i thought why not to write a simple yet effective blog post on 3D touch feature of iOS 9 ? But first question is we don’t have devices so how do we test ? This was the same question arise in my mind, so i googled it and result was “Simulators do not support 3D touch” ohh crack !!!!

But no worries, thanks to this awesome work around we now will be able to test it in simulator just Follow this steps given below.

Step 1 :

Add Simulator support

git clone https://github.com/DeskConnect/SBShortcutMenuSimulator.git

cd SBShortcutMenuSimulator

make

xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=$PWD/SBShortcutMenuSimulator.dylib

xcrun simctl spawn booted launchctl stop com.apple.SpringBoard

Step 2 :

Add code to your ApplicationDelegate.m file

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self createDynamicShortcutItems];
    // Override point for customization after application launch.
    return YES;
}
- (void)createDynamicShortcutItems {
    
    // create several (dynamic) shortcut items
    UIApplicationShortcutItem *item1 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 1" localizedTitle:@"Item 1"];
    UIApplicationShortcutItem *item2 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 2" localizedTitle:@"Item 2"];
    UIApplicationShortcutItem *item3 = [[UIApplicationShortcutItem alloc]initWithType:@"Item 3" localizedTitle:@"Item 3"];
    
    // add all items to an array
    NSArray *items = @[item1, item2, item3];
    
    // add the array to our app
    [UIApplication sharedApplication].shortcutItems = items;
}

Step 3 :

Run Application and than run following command.

xcrun simctl spawn booted launchctl debug system/com.apple.SpringBoard --environment DYLD_INSERT_LIBRARIES=$PWD/SBShortcutMenuSimulator.dylib

xcrun simctl spawn booted launchctl stop com.apple.SpringBoard

echo 'com.apple.mobilecal' | nc 127.0.0.1 8000

Simulator Screen Shot 16-Oct-2015 5.21.58 pm

Hope this helps, Cheers :)

deeplinking-img-v2
Uncategorized

Deep Linking at first seems to be very heavy & new concept but its actually very useful. But lets first understand what actually deep linking is all about. Assume that you have booked the ticket from app, and you have received an email of that ticket, Email can contain deep link to your app as well as link to website. Now if you open that email from mobile you will get deep link to your app. Clicking on that link you will be redirected to ticket screen in your app.

This particular link which opens app and redirect us to ticket detail screen can be termed as “Deep Linking”. Sounds good but how do we implement this in iOS ? And how can a URL open our app ?

Yes URL can open the app, if you dont believe me try opening Safari in your mobile and type whatsapp:// this will open whats app application. Formate of deep link is <Host>://<Path>/<Query>.  Follow below step in order to achieve deep linking in your app.

Step 1 : Add URL Scheme in your info.plist

Screen Shot 2015-08-14 at 2.57.22 pm

 

In URL Types -> item 0 -> URL Schemes -> item 0 -> ” <Replace with your custom scheme>”

To ensure this scheme is working try building the project and open safari & type <Custom Scheme>:// your application should open.

Step 2 : 

We need to write the function to implement the same in our App Delegate in order to navigate User to perticular screen depending on the parameter & query supplied in the Deep Link URL.

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    NSString *path = [url path];
    NSString *query = [url query];
    if ([query isEqualToString:@"1"])
    {
        vc = [story instantiateViewControllerWithIdentifier:@"homepage"];
        vc1 = [story instantiateViewControllerWithIdentifier:@"firstStoryboard"];
        self.navController=[[UINavigationController alloc] initWithRootViewController:vc];
        [self.navController pushViewController:vc1 animated:NO];
        self.window.rootViewController = self.navController;
    }
    return YES;
}