I’m building an app to share notes called Constellational, and recently I’ve added support for universal links. This makes supporting Google App Indexing straightforward. Here’s how you do it.
$ sudo gem install cocoapods
Then, in a new terminal window/tab:
$ pod init
This creates a Podfile — add the following to it:
pod 'GoogleAppIndexing'
And then install the pod:
$ pod install
If you got a warning about target overriding the ‘OTHER_LDFLAGS’ build setting, open the xcodeworkspace and add $(inherited) as a new line in Build Settings’ Other Linker Flags.
You’re also going to have to remember to use the xcodeworkspace instead of the .xcodeproj from now on :)
Add the header to the top of your AppDelegate.m
#import <GoogleAppIndexing/GoogleAppIndexing.h>
And call the register method in your application:didFinishLaunchingWithOptions: method:
[[GSDAppIndexing sharedInstance] registerApp:your iTunes ID];
To generate your iTunes ID you need to add your app to iTunes Connect.
That’s about it! This fixes #70
Want to share your notes? Sign up here!