samedi 9 mai 2015

UIActivityTypePostToFacebook howto post image and text xcode ios NSDictionary key for text

in My CustomActivityItemProvider I got this code for custom Facebook share items:

@implementation CustomActivityItemProvider

@property(nonatomic,strong) NSString *text;
@property(nonatomic,strong) NSURL *url;
@property(nonatomic,strong) UIImage *image;

- (id)item {
            if ([self.activityType isEqualToString:UIActivityTypeMessage]) {
                return [NSString stringWithFormat:@"%@\n%@",self.text,self.url];
                }

            if ([self.activityType isEqualToString:UIActivityTypePostToFacebook]) {
                //>>>>FACEBOOK
                self.url = [NSUrl urlWithString:@"http://www.google.it"];
                self.text = @"FaceBookText";
                self.image = [UIImage imageNamed:@"imageShare.png"];
                NSDictionary *d = [[NSDictionary alloc] initWithObjects:@[self.text,self.image,self.url] forKeys:@[@"text",@"image",@"url"]];
                return d;
                }
        return @"";
    }

I can't send image and text... I have try with all possible key: "title" or "text" or "description" but nothing.. I see the img, I see the url.. but I don't see any text... can anyone explain what I'm doing wrong ??

thanks you !

Aucun commentaire:

Enregistrer un commentaire