2011-12-01 63 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];