Today, we will talk about implementing the 3D Touch for iOS Devices using “OBJECTIVE C“.
“I will take couple of minutes (please bear :)) to vent out my frustration at Apple KB for giving Objective C a step-motherly treatment for promoting their retarded Swift language for documenting new features.”
The reason I have emphasized Objective C above is because of a reason; there isn’t any proper documentation available written in Objective C for using / implementing 3D Touch. I did spend time to understand and implement 3D Touch in Objective C and I don’t want others to through the same process. OK – So Let’s Get Started !!
This blog assumes the reader has a knowledge of Objective C, XCode IDE and Apple’s newest feature – 3D Touch!
There are 5 Steps to implement this!
Open Xcode and create a Single View Application, with the name “test3D”
You need to remember, that the Quick Launch feature of 3D Touch, is actually executed from your Home Screen. So, you need to keep the following attributes ready:
Image for the Quick Launch
Quick Launch Shortcut Title
Quick Launch Sub-Title
Step 3: In your XCode Project, open the Assets.xcassets image catalog file, and right click on vacant area, you will be shown a context menu option. Click the “New Image Set” menu.
After clicking the New Image Set menu, you will be shown an area, where-in you can drag and drop your image on the three image image placeholders, as shown below:
You are required to drop three images, one onto each placeholder.
I dropped in an image for 1x at 35px X 35px and for 2x – 70px X 70px and for 3x – 105px X 105px
Remember: For each menu option, there would be a new Image Catalogue that needs to be created.
For now lets use only a single menu for our 3D Touch Quick Launch example. An appropriate / meaningful name must be given to each of the image set catalogue.
Now lets shift our focus on the Info.plist file we have in our project.
Here you need to create an Array of Dictionary type for each of the Quick Launch menu option.
In the Info.plist file, right click the row and click “Add Row”
And then add the UIApplicationShortcutItems Key with the Type Array.
Now add a new Dictionary within the newly created UIApplicationShortcutItems array. Right click on the UIApplicationShortcutItems array and click Add Row as shown below:
Now add Item 0 with type Dictionary
You need to add 4 attributes into this Dictionary:
UIApplicationShortcutItemTitle: Here is where you add give title to your Quick Launch menu item
UIApplicationShortcutItemSubtitle: Here is where you add a “meaningful” subtitle to your Quick Launch Shortcut Item
UIApplicationShortcutItemType: You must give a name to your ShortCut item. This name will be identified in this application, when the QuickLaunch Item will be pressed. So again, please give a meaningful name to it
UIApplicationShortcutItemIconFile: It is here that you refer the name of your Icon Catalogue in Step 2. In our example it was just by the name “Image”.
As shown below, we add the four Quick Launch attributes to the Dictionary item:
Now we will shift our focus to the AppDelete file in our project. Click open the AppDelegate.m file and add the completionHandler for the ShortcutItem
*NOTE: I have declared a global variable by the name
Firstly, Add the Below code into application:didFinishLaunchingWithOptions function
* I have removed few boiler plate code here from the AppDelegate.m
Add Global Variable with the name asShortCutType
Please note that in the shortcutItem.type check, we are specifying the name that we had added into the UIApplicationShortcutItemType attribute – <Product Bundle Identifier>.Square
By now, your application should be having a Quick Launch short cut item popping out, when you press on the application icon in the Home Screen
Now when you press the Square Quick Launch menu item, the completion handler in the AppDelete.m gets fired. It is here that, if you have multiple menu item, then you can identify it by using Global Variable declared in the AppDelegate file.
In our example, the global variable is by name asShortCutType
Add the reference to AppDelegate.h file. And add the code in the viewDidLoad event of the ViewController. It is here that the value of the variable in the AppDelete.h file gets passed to the ViewController, and the ViewController gets notified, which menu option was clicked.
Step 5: (Last but very important!)
Now that you are enjoying that the Quick Launch is getting fired, there is one more thing to apply the 3D Touch Quick Launch completely.
There is a stage in the application, where in the application is in the background state, when you press the home button.
In that case, the viewDidLoad event will not fire at all and your ViewController will not get to know, which menu option got clicked.
There is a workaround for this too 🙂 . In your viewDidLoad event handler, add the below line of code:
Today, I talk about an error that you might face, while transmitting large information using your IIS .NET Web Service.
I faced this problem, while I had my web service with a valid SSL certificate. I did not find this error message when I did not connect my web service with a SSL Certificate. I had a image also to be uploaded in the same request.
The solution to this is problem is a straight-forward one, but a little tricky to find 🙂
You will have to first open the applicationHost.config file, which should reside in your <Windows Installation Drive:>\Windows\System32\inetsrv\config\
Please take a backup of the existing applicationHost.config before you make any changes to it.
Open the file, and as you see, it is a fairly large file, with different XML tags relevant to IIS Web Sites. You need to scroll down and find your IIS Web Site Name.
If the Web Site name is not found then you can add it, so don’t worry if you don’t find it.
What is written here in common terms is, you are suggesting the IIS to increase the buffer size of the transmitted data to 10 MB for your web site.
And if all goes good, you are able to now transmit information to your IIS .Net Web Service!
Hello All, Its been a while, since I am away from my blogs. I hope I have not missed much !
Today, I will take you through a situation where you have a iPad Application or a iOS application with Universal device support (iPhone & iPad) and you want to create an archive and upload the build to the Apple iTunes Connect Build repository for app review.
Well, since few months back, Apple has changed the policy to review the applications that you have built. It now also undergoes into the processing stage, where, it will check if all the required attributes for the application is available on the Info.plist file.
I had recently tried to upload my iPad app on the Apple iTunes Connect portal for app review. And while undergoing the process of uploading an app to the iTunes Connect portal, I encountered these error messages:
After researching for a while, I found that I am missing a attribute to add into the Info.plist file for allowing the application to know, if it supports multitasking or not. Presumedly, it is for the new iOS 9 feature for iPads which allows a split screen view for multi-tasking.
So, what do we do now?
Open the Info.plist file, and add the UIRequiresFullScreen attribute to it and specify the type to BOOLEAN and specify True or False, depending upon your app’s requirement.
Then you can archive and upload to the Apple iTunes Connect portal for app approval.
Bare in mind, the app also undergoes a stage, where it simply shows the status as (Processing). And it will be there, until you upload a new build version with all the applications’ required attributes to be added into the Info.plist file.
I had few of them in the builds section in iTunes Connect with incomplete attributes, and it will lie there for now 🙂