ios sharekit 2.0 not showing image preview when sharing image - ios

I'm using Sharekit2.0 to share images to facebook and twitter.
Here is the code used for sharing the image in facebook.
SHKItem *sharerItem = [SHKItem image:image title:#""];
SHKTwitter *sharer = [[SHKTwitter alloc] init];
[sharer setItem:sharerItem];
[sharer share];
But this not showing any preview of the image when sharing (like twitter is showing). just a text view to enter title for image.
My question would be: is it possible to show to image preview when sharing to facebook ?
Thanks

Try:
SHKItem * sharerItem = [SHKItem image:image title:#"P"];
[SHKTwitter shareItem:sharerItem];

Related

Swift iOS Facebook SDK: How to share an animated GIF?

I have a document's directory path of a gif I'd like to post to Facebook, but unfortunately when I use this process, it posts a static image instead of it being animated. I know it's animated because I can save the same image to my camera roll and see that it animates. Is there anyway of posting an animated version of this GIF?
let image = UIImage(contentsOfFile: path) // document directory path
let sharePhoto = FBSDKSharePhoto()
sharePhoto.image = image
let content = FBSDKSharePhotoContent()
content.photos = [sharePhoto]
let shareDialog: FBSDKShareDialog = FBSDKShareDialog()
shareDialog.shareContent = content
shareDialog.mode = .native
shareDialog.show()
This is not as issue with your image due to Facebook natively not support gif image directly uploaded on it.
You can share gif image link on Facebook and it will show there gif image. Like as commonly peoples are using giphy, tenor website and share gif image link from this website. So gif image display via this type of website.
I hope this will help you.

App icon is not showing in CallKit UI

I have configured my Provider Configuration for CallKit iOS. In which I have also set 'iconTemplateImageData' for displaying app icon in CallKit UI. But app icon is not showing. It shows a white square box.
Provider Configuration Code:
CXProviderConfiguration *configuration = [[CXProviderConfiguration alloc] initWithLocalizedName:[NSString stringWithFormat:#"%#\n", _title]];
configuration.maximumCallGroups = 1;
configuration.maximumCallsPerCallGroup = 1;
UIImage *callkitIcon = [UIImage imageNamed:#"AppIcon"];
configuration.iconTemplateImageData = UIImagePNGRepresentation(callkitIcon);
_callKitProvider = [[CXProvider alloc] initWithConfiguration:configuration];
[_callKitProvider setDelegate:self queue:nil];
_callKitCallController = [[CXCallController alloc] initWithQueue:dispatch_get_main_queue()];
I have used AppIcon images in 'Images.xcassets' with sizes: -
1x: 40*40, 2x: 80*80, 3x: 120*120
Please help why my app icon is not showing.
Thanks in advance.
This is likely because you are using your AppIcon image, which is a fully opaque image, i.e. no part of that image is transparent or has alpha=0.
To get the desired effect, you have to use a different image which is partly (or mostly) transparent. The native in-call UI will only use the alpha channel of the image you provide, so it ignores colors. I suggest following the example in the Speakerbox sample app and providing a secondary PNG image in your image asset catalog with transparency.
You need to use below code in order to set app name and app icon for incoming VOIP calls
let localizedName = NSLocalizedString("App-Name", comment: "Name of application")
let providerConfiguration = CXProviderConfiguration(localizedName: localizedName)
providerConfiguration.iconTemplateImageData = UIImage.init(named: "appicon-Name")?.pngData()
Note: Your app icon must be transparent. result will be like in below image

UIActivityViewController share to Facebook

I want to use UIActivityViewController to share something to Facebook, and I want to customize my "image card space", So I can click the blue area and direct to other website
the image is from Facebook, and it say the blue area is image card space
this is a screen shot from other app, this app use UIActivityViewController too, so I believe it can be done, I try to search the information about how to implement, but it fail, maybe I use the wrong key word
this is my code
UIImage *Img = [UIImage imageNamed:#"myImg.png"];
NSString *myString = #"hi, I am strign";
NSURL *myUrl = [NSURL URLWithString:#"www.google.com"];
NSArray *items = #[myString, Img, myUrl];
UIActivityViewController *avc = [[UIUIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
self presentViewController:avc animated:YES completion:nil];
and this is what I get
just Image appear
myString does not appear, I guess this is because,it will appear in"user message field", and this is illegal(the first image), so iOS delete it
but where is my URL? if I post this to Facebook, it just a Image, I can't direct to other website
Is anyone know how to customize image card space?
=====================edit==================
ok, i think i got it
the app not customize the area
it just put the url
and iOS get the data automatly, and display it
so, just put url to UIActivityViewController
if anything wrong please re correct me

How can parse all the images form Website in IOS SDK

I like to implement image upload functionality in my app.For that I like to give some option for user to choose image.
One of the option is choose image from website.
If the user enter an url link in the text box and click the get images button means. I like to display all the images in that particular link
But I am not having any idea about this.
I have explain my requirement below
1)Enter the url in a text box
2)Click the get images button
3)Parse all the images from that particular url
4)Display all the images in the Imageview
And also to illustrate my requirement I have attached the screenshot below
If anybody work around this functionality means please suggest me some idea
Thanks
Like this ?
- (IBAction)buttonClicked:(id)sender
{
NSURL *url = [NSURL URLWithString:#"http://www.yourwebvsite.com/image.png"];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData: data];
UIImageView *displayImageView = [[UIImageView alloc] initWithImage:image];
[displayImageView setFrame:CGRectMake(0, 0, 300, 300)];
[displayImageView setContentMode:UIViewContentModeScaleAspectFit];
[self.view addSubview:displayImageView];
}
Or if you want all the images from a web directory. See here and save all the images in an array then display the images in a UIImageView like my code above.

Add a default sentence while sharing an image on Facebook

Does anyone know how to set a default sentence when the user shares something on his wall? Im not asking about the the user's text. I'm asking how to show the tagline "... took a photo with ...".
Refer this link.
UIImage *image = [UIImage imageNamed:#"Image.jpg"]; // You Image that u want to share
SHKItem *item = [SHKItem image:image title:#"XXX : took a photo with Instagram"];
[SHKFacebook shareItem:item];
Hope it worked for You.

Resources