"symbol(s) not found for architecture i386" problem using ShareKit

andi1984 picture andi1984 · Jul 31, 2011 · Viewed 9.4k times · Source

I want to use the http://getsharekit.com framework for future iOS projects. Hence I started testing out the framework.

But I already get the following error:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SHKItem", referenced from:
  objc-class-ref in ShareKitTestAppDelegate.o
"_OBJC_CLASS_$_SHKActionSheet", referenced from:
  objc-class-ref in ShareKitTestAppDelegate.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Often, as far as I know, these problems arise if header files are wrongly imported. But I don't see any error here in the following code where the problem above occurs:

#import "ShareKitTestAppDelegate.h"
#import "SHK.h"
#import "SHKItem.h"
#import "SHKActionSheet.h"
- (IBAction) letshare:(id)sender
{  
   // Create the item to share (in this example, a url)
   NSURL *url = [NSURL URLWithString:@"http://getsharekit.com"];
   SHKItem *item = [SHKItem URL:url title:@"ShareKit is Awesome!"];

   // Get the ShareKit action sheet
   SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

   // Display the action sheet
   [self.window addSubview:actionSheet];
}

I also included the ShareKit Headers Folder into HeaderSearchPath Build-Options, because of searching for all the headers.

But I don't see any error here or anything missed.

Can somebody help me?

With best regards,

Andreas

Answer

Pål de Vibe picture Pål de Vibe · Apr 17, 2012

I had a similar problem with the following linker error:

Undefined symbols for architecture i386: "_OBJC_CLASS_$_SHK"

I resolved it by adding SHK.m to compiled sources under Project settings->Target->Build Phases. Not sure why SHK.m was not in the compiled sources list, and it was working previous to duplicating the Target. After the duplication I couldn't link any of the targets.

Adding SHKItem.m or SHK.m to compiled sources might help you if they aren't there already.