0

We want to implement Google's iOS App indexing into our app. So, I followed the guide over here:

https://developers.google.com/app-indexing/ios/app

Installed CocoaPods as well, which was seamless. We then added this code:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    NSURL *sanitizedURL = [GSDDeepLink handleDeepLink:url];

        NSLog(@"isdeeplinkApp    %@", [GSDDeepLink isDeepLinkFromGoogleAppCrawler:url] ? @"Yes" : @"No");
        NSLog(@"isdeeplinkSearch %@", [GSDDeepLink isDeepLinkFromGoogleSearch:url] ? @"Yes" : @"No");
        NSLog(@"sanitized-url    %@", sanitizedURL);

          return YES;
        }

We then tested it with our custom URLs after adding it to the Plist file.

Which looks like this for URLSchemes

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>googleapp</string>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>IDENTIFIER</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>IDENTIFIER </string>
        </array>
    </dict>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>gsd-IDENTIFIER </string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>gsd-IDENTIFIER </string>
        </array>
    </dict>
</array>

However our app is crashing on launch (Before even hitting our own code) at the first line in the openURL method:

NSURL *sanitizedURL = [GSDDeepLink handleDeepLink:url];

The error:

+[UIFont gsd_fontOfSize:]: unrecognized selector sent to class 0x112af3f48

According to Google we should do this if we get this error at runtime:

If you see a runtime error that looks something like: +[UIFont gsd_fontOfSize: ] : unrecognized selector sent to class 0xXXXXXXXXXX, make sure that you are correctly using CocoaPods, as outlined in the Get Started section on the CocoaPods website. Note that you should be opening the Xcode workspace generated by CocoaPods instead of the project file when building your project. CocoaPods will set some necessary linker flags.

If you're still seeing issues, make sure that the -ObjC linker flag has been set in the "Other Linker Flags" row in Build Settings.

However that has not solved the issue for us. As a test, I decided to start a demo project and test the links out there. On the demo app - it works just fine. So we're thinking its probably a project setting?

PaulG
  • 13,871
  • 9
  • 56
  • 78
Robert J. Clegg
  • 7,231
  • 9
  • 47
  • 99
  • You need to do a lot more than just install CocoaPods. You need to actually create the `PodFile` file to include the appropriate pods for the libraries you want to use. – rmaddy Jun 18 '15 at 14:00
  • Sorry forgot to add I did that and added the Google sdk. – Robert J. Clegg Jun 18 '15 at 14:06
  • And you ran "pod install" to actually install the library? – rmaddy Jun 18 '15 at 14:07
  • Yes the sdk gets added to the project as I can use it. It just crashes when the app is opened with the deep link. Crashes on googles code. As I said if I create a demo project it works. Adding to this project it doesn't. At a loss with this. – Robert J. Clegg Jun 18 '15 at 14:11
  • Did you figure this out? I'm experiencing the same issue and it won't even compile. – TruMan1 Jul 16 '15 at 12:09
  • No. We've contacted Google about this a few weeks back. No response as yet. We got it to compile just fine. Link me to your question on SO, I'll take a look. – Robert J. Clegg Jul 16 '15 at 14:43
  • Here it is but is for Swift: http://stackoverflow.com/questions/31514747/google-app-indexing-not-resolving-for-swift/31526368 – TruMan1 Jul 21 '15 at 12:57

0 Answers0