i want to share app info on social network with all social networking application that are previously installed in device. i have one demo images just like this, if any idea please give me.
Thanks in advance
Using UIActivityViewController you can Share, apple doc
Example:
UIImage *anImage = [UIImage imageNamed:#"SampleImg.png"];
NSArray *Items = [NSArray arrayWithObjects:
#"your app info",
anImage, nil];
UIActivityViewController *ActivityView =
[[UIActivityViewController alloc]
initWithActivityItems:Items applicationActivities:nil];
[self presentViewController:ActivityView animated:YES completion:nil];
Here’s a UI control called REActivityViewController from Roman Efimov that looks like a UIActivity view, but allows for full color icons, total customization, and the control works with iOS 5.0. The control looks and works as expected on iPhone and iPad.
This is not simply a control that looks like UIActivityController, but also makes it much easier to create custom activities.
Here’s an example from the readme showing how easy it is to create a custom activity controller:
REActivity *customActivity = [[REActivity alloc] initWithTitle:#"Custom"
image:[UIImage
imageNamed:#"REActivityViewController.bundle/Icon_Custom"]
actionBlock:^(REActivity *activity, REActivityViewController *activityViewController){
{
[activityViewController dismissViewControllerAnimated:YES completion:^{NSLog(#"Hey, there!");}
];
}];
Try this.Happy coding.
Related
In my app I have added these lines of code to incorporate the functionality of uiactivityviewcontroller
UIImage *yourImage = someImg;
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObjects:#"abcdefgh",yourImage, nil] applicationActivities:nil];
activityVC.excludedActivityTypes = #[ UIActivityTypeMessage ,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll];
[self presentViewController:activityVC animated:YES completion:nil];
and UIActivityViewContoller working fine, but the UI is like this: no FB icon, no Twitter icon and this is a screen-shot of an iPad:
However it is showing perfect UI in iOS 6. What might be the reason for this?
Let me tell you that your code is correct, after some test finally I could fix it, just go to Settings add Social Accounts (Facebook - Twitter - Flickr - Mail), run again your app and you will see the icons. Regards from Cancun!
Are you using the Simulator? In my experience, UIActivityViewController the UI is buggy in the simulator, but if you test on an actual device, it runs fine.
Try testing on a device.
the problem was with the device.. It was running well in iPhones
I want to write an automatic photographic app that can run in the background. Can anyone tell me how to do.
i have tried AVFoundation. but still not work. i don't see any app like this. so, i think it is very difficult or impossible?
someone tell me this:
NSLog(#"staring......\n");
UIImagePickerController *pic = [[UIImagePickerController alloc] init];
[pic setTitle:#"take a photp"];
//[pic setDelegate:self];
[pic setSourceType:UIImagePickerControllerSourceTypeCamera];
//pic.showsCameraControls = NO ;
NSLog(#"input conmand\n(t)");
[pic takePicture];
and i run it on my iPhone, just nothing happened.
please help me, guys.
It is not possible for an app to take pictures in the background for privacy reasons. There are currently no api for this and any app that finds a way to do so will get rejected from the App Store.
I'm trying to use UIActivityViewController to share an image from my app. This is the source code:
UIImage *sourceImage = [[UIImage alloc] initWithContentsOfFile:[[self currentMedia] path]];
NSArray *activityItems = #[sourceImage];
UIActivityViewController *avc = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
avc.excludedActivityTypes = [NSArray arrayWithObjects:UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, nil];
[self presentViewController:avc animated:YES completion:nil];
[avc release];
[sourceImage release];
Everything works fine except for one issue: I don't see service names (Email, Twitter, Facebook etc) in the service picker. Look at the screenshot below:
Am I doing something wrong?
I am using ARC and don't have such problem. As far as UIActivityViewController is hardly rely on multithreading and blocks it is possible to affect some objects lifetime. So I would try to switch to ARC as recommends Apple or at least to make retained class property for UIActivityViewController.
If you pass nil for the activity types and you specify excluded types, nothing will show up.
However if you just pass nil for the first parameter, all the available built-in service types will show up.
I'm still having a bit of trouble getting this API to behave as I want it to, but that's one thing I did find.
You can use UIActivity class for this purpose. Activity objects are used in conjunction with a UIActivityViewController object, which is responsible for presenting services to the user.
look into activityTitle method of UIActivity class it returns string that describes the service.
Here is Example project.
Hope it helps you.
I have an app that shares with instagram built for iOS5 and now in iOS6, sharing no longer works although canOpenURL returns true and code executes. The images are saved to the documents folder of the application with a .igo extension. This is passed to instagram with com.instagram.exclusivegram.
The code is below, it enters the if statement and displays "here in" but does not open the Share With dialog like it used to at the bottom of the screen.
NSLog(#"%#", _imgToUpload);
NSURL *instagramURL = [NSURL URLWithString:#"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
uidController = [[UIDocumentInteractionController alloc] init];
//imageToUpload is a file path with .igo file extension
uidController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:_imgToUpload]];
uidController.UTI = #"com.instagram.exclusivegram";
uidController.delegate = self;
CGRect navRect = self.view.frame;
[uidController presentOpenInMenuFromRect:navRect inView:[UIApplication sharedApplication].keyWindow animated:YES];
NSLog(#"here in");
}
_imgToUpload is providing the correct filepath as well.
Thank you,
Nick
Just did some testing and found a solution. Do not present in the keyWindow.
[uidController presentOpenInMenuFromRect:navRect inView:self.view animated:YES];
I have tested this and it will fix the problem.
Another reason for the uidocumentinteraction controller not working in iOS6 is that the new action sheet/launch panel (it shows apps available to open the doc) is now used. My app which worked fine launching iBooks with iOS5 failed because I launched from viewDidLoad which was now too early and I got an error on the current view controller 'whose view is not in the window hierarchy' so I changed my code to performselector after delay of 1 second. The app now calls iBooks via the new panel.
I have implemented a basic add contact feature to an iOS 4 application. Following the documentation from Apple, I have created a navigation controller, and set its root view to the ABNewPersonViewController. I have implemented the delegate as well. The basic mechanics all work.
The problem I am having is when you add a photo to the new person that is very large (taking a photo or picking one from the library), the ABNewPersonViewController form returns empty when the camera controls are dismissed. No photo is in the add photo box either. If I pick a small image (say a screenshot from the iPhone), everything works. I can see from the debug output: Received memory warning. Level=1
Has anyone else run into this? Is there a way to set the photo quality to a lower setting for the ABNewPersonViewController? Any help appreciated.
ABNewPersonViewController *abNewPersonView = [[ABNewPersonViewController alloc] init];
abNewPersonView.newPersonViewDelegate = self;
UINavigationController *newNavigationController = [UINavigationController alloc];
[newNavigationController initWithRootViewController:abNewPersonView];
[self presentModalViewController:newNavigationController animated:YES];
[abNewPersonView release];
[newNavigationController release];
If ABNewPersonViewController does not handle memory warnings correctly, file a bug with apple.