quick_action

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 :)

Implementing 3-d touch

Aadil Keshwani

People call me geek i call myself Coder. I like to explore & learn new things, R&D and Innovation motivates me. By profession i am iPhone Developer but i have sound knowledge of PhoneGap, HTML, CSS3, WordPress, Photoshop, PHP, CodeIgniter, OpenCart. Feel free to contact me for any queries or help in above technologies, i would be more than happy to help you out.

Category: Uncategorized
657 views