2011-12-01 56 views
0

我已經寫了一些代碼使用Sharekit在Facebook上分享圖像。該代碼是以下各項之一:圖片不出現在Facebook

NSString *str = [NSString stringWithFormat:@"00%d",currentIndex_+1];   
NSString *imageIndex = [[NSBundle mainBundle] pathForResource:str ofType:@"png"]; 
NSLog(@"image index:%@",imageIndex); 
// NSData *myData = [[NSData alloc] initWithContentsOfFile:imageIndex]; 

SHKItem *item = [SHKItem image:[UIImage imageNamed:imageIndex] title:@"Sent via Card Application iPhone App"]; 
[NSClassFromString(@"SHKFacebook") performSelector:@selector(shareItem:) withObject:item]; 

該錯誤消息,「必需的上傳文件」被示出。

如何解決此問題?

回答

1

那麼下面可能會有所幫助:

NSString *imageIndex = [[NSBundle mainBundle] pathForResource:str ofType:@"png"]; 

將返回到圖像的路徑。

[UIImage imageNamed:imageIndex] 

從應用程序包中按照名稱獲取圖像。 您在此處傳遞路徑和名稱,以免找到圖像。

試試這個:

SHKItem *item = [SHKItem image:[UIImage imageNamed:str] title:@"Sent via Card Application iPhone App"]; 
[NSClassFromString(@"SHKFacebook") performSelector:@selector(shareItem:) withObject:item];