Tuesday, February 28, 2017

Xcode + Archive created of Zero Bytes


Hi all,

Now this is something funny. I created a cocoa project, build it and ran on my mac. It worked pretty well.

So for distribution I decided to create an archive : Xcode >> Products >> Archive
It was a success but to my surprise the archive was of Size ZERO.

Searched a lot and applied 2 things and VOILA it worked :P

Lets find the Solution


  • Set the Installation Directory of the Target and its dependent targets as /Applications/






  • Skip Install under Build Settings should be set to NO for the Target and all its dependent targets.





Xcode + Implicit Conversion Looses Integer Precision Error


Hi Friends,

Ever faced this issue on upgrading xCode or switching old project on xCode 5 to new xCode. Here is the Solution :)

Error
Implicit Conversion Looses Integer Precision

What is this Error
On a 64 bit system and xCode 5.1 the default architecture is 64 bit and accordingly NSInteger / NSUInteger changes its size.

Resolution
Xcode
Project
Target
Build Settings

  • Set Implicit Conversion to 32 Bit Type as NO
  • Set Treat warnings as Errors to NO








Monday, February 6, 2017

Apple Universal Links: A path to remember



Hi All,

Struggled hard to implement the UNIVERSAL LINKS. A nice but confusing procedure.


What are Universal Links
Universal links are the way to implement deep linking on iOS 9 and above.
Earlier defining Custom URL Scheme was the only simplest way to achieve deep-linking but n
ow the Associated Domains come into picture for handling deep-linking.


En-route to Implementation part...


***** Xcode Layer *****

Step 1 :
  • Open your xCode Project
  • Goto Target 
  • Click General
  • Set Bundle Identifier (Example : com.blog.spot )




Step 2 :
  • Click Capabilities
  • Enable Associated Domains
  • Click + in Domains and write (Example : applinks:india.com/apple-app-site-association)






Step 3 :
  • On Enabling Associated Domain a file Target.entitlements gets added in your project.
  • Please ensure this gets added in Targets Membership and the build.
  • You can view this in Identity Inspector.





Step 4 :
  • Click Build Settings
  • Under Signing Sections you can find Name of your Code Signing Entitlements as Target.entitlements

Step 5 :

  • Click Info.plist file.
  • Add URL Identifier as com.blog.spot under Url Types.
  • Add URL Scheme as com.blogspot under Url Types.


Step 6 :
  • Open Apple Developer Program.
  • Enable Associated Domains for your App Identifier.
  • Use the new certificate and provisioning profile for Build installation.



***** Server Layer *****
  • Buy a domain or use any existing one.
  • Acquire SSL Certification for it.
  • Create a JSON File  : apple-app-site-association.
  • Upload this file on the server.
  • It must return 200 http code.
  • Content type of File Must be proper.
  • For Verification you can use : https://limitless-sierra-4673.herokuapp.com/



JSON Structure{    "applinks": {

"apps": [],

"details": [{

"appID": "AB123CD4EF.com.blog.spot",

"paths": ["*"]

}]

}

}


AB123CD4EF.com.blog.spot
         |                         |
        ↓                         |
   Team Id                
                       Bundle Identifier


Verification

  • Create an HTML page and place on any server.
  • On page load call a method say open.
                function open()                  {  window.location = "blogspot://?user=100";  }

  • Now  goto Safari App, refresh and a popup must be visible.

  • Click Open and it should be redirected to your installed App
  • However if App is not installed an error pop up will display 





Notes:
  • Universal Links do not work with redirects.
  • With Gmail Universal Links perfectly fine.
  • Do not append .json in apple-app-site-association file

Hope it helps and save people from traums:)