Nov 09

ShareKit has recently become one of my favorite iPhone open source projects. Just add a few lines of code to your app and you can instantly share text, URLs and other data via Email, Twitter, Facebook and a whole slew of other services.

I’ve found a couple of minor issues with the current release (version 0.2.1) of ShareKit, and I thought I’d share them to save you a couple of hours of debugging.

Error when building for device

This seems to be a known issue, that may depend on your Xcode install.

If you get 12 compiler errors when building for a device, starting with:

ShareKit/Core/SHK.m:35:28: error: objc/objc-class.h: No such file or directory

Then the solution is to change this import statement in SHK.m:

#import <objc/objc-class.h>

to:

#import </usr/include/objc/objc-class.h>

or:

#import <objc/runtime.h>

Hardcoding the path to something outside of Xcode or your project directories seems like bad idea. So I went with the second solution.

Conflicting Localizable.strings

The ShareKit project contains its own Localizable.strings files in the ShareKit / Localization directory. If your project is also localized there will be a conflict over which Localizable.strings file will be used at runtime.

There are a couple of ways to resolve this conflict:

  1. Remove the ShareKit files from your build target. This is the quickest solution, but you will lose the localizations provided in ShareKit (currently only German).
  2. Copy the contents of the Localizable.strings files from ShareKit to your Localizable.strings files. And then remove the ShareKit files from your build target. This works well when you have corresponding localizations.
  3. Rename the ShareKit files to ShareKitLocalizable.strings and then replace the NSLocalizedString macros in the ShareKit code with NSLocalizedStringFromTable where you can specify the ShareKitLocalizable.strings filename as the tableName.

written by Nick \\ tags: , , , , ,

12 Responses to “ShareKit”

  1. object2.0 Says:

    Thanks Nick, you solved my build issue.

  2. Faz Says:

    super, thanks man ! Very helpful.

  3. me Says:

    Man, THANK YOU! I spent hours trying to find out why my localization wouldn’t work. That was it. Thanks.

  4. ps Says:

    thank you for this post!!! upgraded to lion, suddenly got this when building something that worked fine yesterday – already solved thanks to your post. cheers!

  5. Jash Sayani Says:

    Thank you! This solved my problem after upgrading to Lion!

  6. adedoy Says:

    thanks man, you’re a life saver

  7. Ian Says:

    The localization thing, bit us bad because our app wasn’t localized but adding ShareKit silently made it appear so and unfortunately the app now claims to support German in iTunes.

  8. xsergiom Says:

    #import

    Solve the problem for ios5.1 at lion.

  9. xsergiom Says:

    #import objc/runtime.h

    the or option
    Solve the problem for ios5.1 at lion.

  10. shelby Says:

    solved; you did save hours of time!

  11. pBalliett Says:

    Any chance to update ShareKit for Xcode 4.5 and IOS Deployment Target 6.0?

  12. Kirti Says:

    Thanks a lot,I was try to solve for long time

Leave a Reply