UIActivityViewController in iOS 7 - iphone

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

Related

FBFriendPickerViewController for iOS 7 doesn't work as expected in landscape mode

I am working for Facebook integration in my iPad app. I am using FBFriendPickerViewController for same. My app is working fine on iOS 6 for landscape as well as portrait mode but when I use iOS 7 then friend picker controller works fine ONLY for portrait. When try to launch it in landscape mode then white view pops up. I could see faint friend picker view in background but very hard to see that. Do anyone have any idea what must be the reason? Code base I have used is as below.
if (!_friendPicker) {
self.friendPicker = [[FBFriendPickerViewController alloc] init];
// _friendPicker.delegate = self;
_friendPicker.title = #"Select a friend";
_friendPicker.allowsMultipleSelection = NO; // Share dialog doesn't allow more than one recipient
}
[_friendPicker clearSelection];
[_friendPicker loadData];
_friendPicker.modalPresentationStyle = UIModalPresentationFormSheet;
[_friendPicker presentModallyFromViewController:self
animated:YES
handler:nil];
Same thing I have observed on facebook sample app "HelloFacebookSample" :)
Try:
Get the newest Facebook SDK, because in the above link a Facebook rep says the issue should be resolved. The modal frame still takes into account the space for the status bar so you'll have to find a way to deal with it (doesn't bother me enough to spend time solving it at this point).
I also removed a [[UINavigationBar appearance] setTitleTextAttributes:]; line from my app delegate, so maybe try removing all nav bar customisation and see what you get.
Good luck.

Sharing option with iOS app?

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.

Launching the app store dialog box?

I just noticed in iOS 6 that in your default Mail app, if you tap an itunes URL, an app store dialog box actually opens displaying the app's details.
There's no redirect to the app store! This box shows the screenshots, descriptions, etc. as if you were already in the app store.
I'm wondering if its possible to launch this box from inside my own app. I currently use itms-apps:// which naturally leaves my app, and goes to the app store.
If you are developing for iOS 6+ only, you can use SKStoreProductViewController.
Something like this:
SKStoreProductViewController *storeViewController =
[[SKStoreProductViewController alloc] init];
storeViewController.delegate = self;
NSDictionary *parameters =
#{SKStoreProductParameterITunesItemIdentifier:
[NSNumber numberWithInteger:333700869]}; //Identifier of the item you want to buy.
[storeViewController loadProductWithParameters:parameters
completionBlock:^(BOOL result, NSError *error) {
if (result)
[self presentViewController:storeViewController
animated:YES
completion:nil];
}];
(Code from this tutorial.)

Using popover control in iPhone

pop = [[UIPopoverController alloc] initWithContentViewController:popoverView];
pop.delegate = self; //optional
CGSize size = CGSizeMake(300, 100); // size of view in popover…V2
pop.popoverContentSize = size;
[pop presentPopoverFromRect:control.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Youtube link: http://www.youtube.com/watch?v=1iykxemuxbk
It works fine in simulator, but crashes when running on iPhone.
I can easily get so many articles to implement on iPad, but on iPhone couldn't find a fruitful one. Plz help
UIPopOverController isn't available for iPhone. ONLY iPad.
UIPopOverController will not work for iPhone it will work on Ipad only
If you want to simulate a popover look-alike (e.g. Facebook app), on the iPhone, you will have to code it from scratch using UIViews and custom graphics.
As others said, the popover API is iPad-only.
A popover-like open source project that works on iPhone:
here it is
Try using WEPopover framework. Here is the link https://github.com/werner77/WEPopover
If you really want to use popover in iphone then try this library. This is pretty cool. I integrated with my ios app.
Custom popover controller for iphone

Open Twitter settings from app in iOS 5.1

I am implementing Twitter in my iPhone application and if the user does not have any Twitter accounts set up, I would like him to be able to open his Twitter settings from my app. Is there any way to do this in iOS 5.1?
In iOS 5.0 we could do as below but I have not managed to find a way to do this in 5.1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=TWITTER"]];
Try this..
TWTweetComposeViewController *ctrl = [[TWTweetComposeViewController alloc] init];
if ([ctrl respondsToSelector:#selector(alertView:clickedButtonAtIndex:)]) {
// Manually invoke the alert view button handler
[(id <UIAlertViewDelegate>)ctrl alertView:nil
clickedButtonAtIndex:0];
}
[ctrl release];
I don't know the reason why but Apple has removed the settings apps URL Schemes. Yes it was working in iOS 5.0 but it doesn't work in 5.1