Get Application Icon Image From Springboard (Jailbreak) - iphone

I'm developing a lockscreen application using theos and part of the functionality requires icon images of certain applications on the phone. How can I go about getting those icon images and displaying them on the lockscreen of the phone?
I've tried everything I could think of so far and have searched through the springboard headers with no luck. I've specifically been trying retrieving the images from SBApplication and SBIconModel from suggestions I found through google, but still I have no luck.
Any help is greatly appreciated. Thanks!

After you %hook a class, inside the method you're using, do the following if for example you're trying to get the icon for the mail app
// Get the SBApplication for the mail app
Class $SBApplicationController = objc_getClass("SBApplicationController");
SBApplication *mailApp = [[$SBApplicationController sharedInstance] applicationWithDisplayIdentifier:#"com.apple.mobilemail"];
// Get the SBApplicationIcon for the mail app
SBApplicationIcon *mailAppIcon = [[objc_getClass("SBApplicationIcon") alloc] initWithApplication:mailApp];
The important thing is to get the right DisplayIdentifier of the app you're interested in.
Hope this help! any problems please shout.

Although, I accept the above as the answer, I ended up using the following code, which displays titles and badges:
SBIcon *sbIcon = [model applicationIconForDisplayIdentifier:identifier];
SBIconView *app = [[%c(SBIconView) alloc] initWithDefaultSize];
[app setIcon:sbIcon];
//if you want the titles to be conditional
[app setLabelHidden:!titlesEnabled];
//if you want the badge view to be conditional
id badgeView;
if (device_version >= 6.0) badgeView = MSHookIvar<id>(app, "_accessoryView");
else badgeView = MSHookIvar<id>(app, "_badgeView");
if (badgeView) [badgeView setHidden:!badgesEnabled];

Related

How to go facebook setting page of the Iphone On click of setting button in alert view IOS6 [duplicate]

I'm trying to integrate Facebook sharing procedure into my app. I'm using UIActivityViewController like this:
NSArray * activityItems = #[self.imgView.image, self.txtField.text];
UIActivityViewController * activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
Till now all have been working fine. But I've met such problem - when I click on facebook icon and enter the facebook sharing screen the alertView appears:
so the problem is - when I click Setting my controller is just dismissed and nothing happens. For twitter all is working well - when Settings button is clicked my app is going background and the Settings is opened. Why this does not work for Facebook? Any help will be appriciated.
ADDED:
Using SLComposeViewController leads to the same behavior - Settings does not open
iOS 6.0.1 resolve this issue. Update software on device it go setting view.
i am having the same issue you update the ios from 6 to 6.0.1 and remove the verification type **SLServiceTypeFacebook** in **SLComposeViewController** at first.,thats all working fine for me now.
This bug seems to be fixed in new version of iOS (6.0.1) At least I have all working well since my last updgrade.
I just integrated the facebook social framework into my app and had exact same issue on iOS 6.1, i.e. when my facebook account is not setup, I will get this warning, but clicking "Setting" will simply dismiss the dialog instead of bringing me to the device's setting page.
I found out this seems to be a simulator ONLY issue, it works perfectly on real device. I'd suggest you to give a try.

Google plus share opens link in browser

I am just trying to implement an iPhone app, that has a feature to share on Google+. So, when I click on share button, it is opening the link in safari. Instead, I would like to have it like Facebook pop-up window. Is there any possibility to implement it?
- (IBAction) didTapShare: (id)sender {
share = [[[GooglePlusShare alloc] initWithClientID:kClientID] autorelease];
/* share.delegate = self; // optional
appDelegate.share = share; //optional*/
[[[[share shareDialog] setURLToShare:[NSURL URLWithString:#"URL_TO_SHARE"]] setPrefillText:descStr] open];
[[share shareDialog] open];
}
This is the code, I’ve used for sharing. And I look up on the GooglePlusShare class, I couldn’t figure out anything possible. Thanks in advance!
I think , right now , this is the preffered way to post on google plus..And
After all. after posting status on google plus..it also comes back to your app..

iPhone: How to add Facebook Sign In Button?? (actual rendering)

I downloaded the Facebook API for iPhone and put it in my project. I am searching all over the internet but can't seem to find out how to actually display the sign up/log in with Facebook buttons in an iPhone App. All the tutorials seem to miss this aspect.. I mean, do I need to find the button images myself from the web and manually add them to the app as buttons? Looking for something like this:
FBSignInButton* b = [[FBSIgnInButton alloc] initWithFrame:CGRectMake(x, y, width, heght)]
[self.view addToSubView:b];
that's it. Trivial right? How do I do it?
I dont think you need to show the button to login to facebook just use
_loginDialog = [[FBLoginDialog alloc] init];
[_loginDialog show];
when ever you think that the user should login to be given access to anything else in your app or something like to get the user info. before your app can do something with the users facebook account.
You can check the ray wanderlich tutorial on the same.
http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app
I hope this is what you are looking for.

ShareKit changes?

I haven't used ShareKit much, but I want to have only three sharing options: Facebook, Twitter, and Email. ShareKit gives far more options, including a More button. However, I don't want the More option, just the three.
In SHKActionSheet.m of ShareKit:
// Add More button
[as addButtonWithTitle:SHKLocalizedString(#"More...")];
It is super easy now, if you use ShareKit 2.0.
edit SHKSharers.plist to include only sharers you need. In case you do not want to compile unused sharers files, check granular install.
You can hide "more..." button in configurator. The new setting is - (NSNumber*)showActionSheetMoreButton
You can disable favourites reordering in configurator. Normally last used sharer is on the top in ShareKit's action sheet. The new setting is - (NSNumber*)autoOrderFavoriteSharers
Using this way you do not need to change or add any code to ShareKit.
I wanted to have the same thing. I spent days to make ShareKit work without too much success. Ok I was able to post FB, Twitter and Email messages but it was more pain the convenience.
Sharekit is an awesome idea but:
You cannot share image, URL and text at the SAME TIME! It has to be
text only, URL only or Image only. Probably you want your user to
post something on FB or Twitter or send an email about your App.
What's the point if the message cannot contain an
App Store or webpage link?
Very badly documented often you have to post questions on
StackoverFlow
It's buggy, not supported by the original designer so there are dozens of forks. You can pick the ShareKit fork, but still.
On it's website it sounds like it's a drag and drop and you can make it work in minutes, good luck for that.
It takes 5 lines to add twitter, about 50 for Facebook and email to support text, URL and photo at the same time.
Twitter: This code sends a message with User editable text, URL (hidden, not editable) and an image. It took me 5 minutes to figure it out.
#import <Twitter/TWTweetComposeViewController.h>
- (IBAction)twitterButton:(id) sender {
TWTweetComposeViewController *tweetView = [[TWTweetComposeViewController alloc] init];
[tweetView setInitialText:#"Check out this app, it's awesome" ];
[tweetView addImage:[UIImage imageNamed:#"MyImage.png"]];
[tweetView addURL:[NSURL URLWithString:appDelegate.appStoreURL]];
[self presentModalViewController:tweetView animated:YES];
}
I really appreciate the effort of creating Sharkit but personally I cannot recommended it unless you really need to support all of those sharers and you happy with limited functionality.
UPDATE:
I implemented Facebook sharing myself. It was more difficult than I thought. The main problem is that you cannot upload a photo with a post because Facebook only accept image links. Even worse Facebook does not allow to link to a photo which is uploaded to the user photo album (very easy) as it must be an external link. For static images you can use a URL shortener to get around it but for user generated images pretty much you have to use Amazon S3 or something else. Amazon S3 is super easy to use, I figured out how to use upload files in an hour or so.
If you don't want the More... button, why don't you take out the line of code that adds it?
you need to make this code changes from SHKActionSheet.m
+ (SHKActionSheet *)actionSheetForType:(SHKShareType)type
// Add More button
//[as addButtonWithTitle:SHKLocalizedString(#"More...")];
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
// More
// else if (buttonIndex == sharers.count)
// {
// SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc]
// initWithStyle:UITableViewStyleGrouped];
// shareMenu.item = item;
// [[SHK currentHelper] showViewController:shareMenu];
// [shareMenu release];
// }
And you can edit SHKSharers.plist for services you like.
you can use the below definition for dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
you need to delete the few lines which is commented in the below definition.
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
{
// Sharers
if (buttonIndex >= 0 && buttonIndex < sharers.count)
{
[NSClassFromString([sharers objectAtIndex:buttonIndex]) performSelector:#selector(shareItem:) withObject:item];
}
// More
//else if (buttonIndex == sharers.count)
// {
// SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc] initWithStyle:UITableViewStyleGrouped];
// shareMenu.item = item;
// [[SHK currentHelper] showViewController:shareMenu];
// [shareMenu release];
// }
[super dismissWithClickedButtonIndex:buttonIndex animated:animated];
}
Excellent solution, however in my case for example want to use Facebook as well and there is no way to share content natively in iOS5. Another problem is that those who need the app compatible with iOS4.0 or higher (my case) can not, because this method only works from 5.0.
How to solve this? ShareKit to Use Facebook and Twitter for the native methods and forget about compatibility with iOS4.0?

iOS ShareKit, twitter logout? facebook status empty?

I am using ShareKit plugin for iPhone to enable social sharing for the application I'm working on. I set up everything, I stripped it to have Facebook and Twitter services only, connected successfully to both and now I have 1 problem in each of the services...
The problem with Twitter is how to logout/signout...
ShareKit sends the text and the url to Twitter's publish box. It is saving status perfectly. The question is where to put "logout" button for twitter? I want the iPhone user to logout in order to change username. This is done by calling the method
[SHKTwitter logout];.
Now, the problem is where to put the button that will fire this method? In navigationToolbar of Twitter actionSheet I already have 2 buttons and the toolbar (bottom one) is covered by the keyboard?
[EDIT]: I solved this issue by modifying the twitter action sheet. I resized the textView and then added UIToolbar and changed its position so that it fits into the gap between the keyboard and textView. Into the toolbar I added one button with an action that calls a logoutTwitter method
Facebook problem is more of a mystery...
So, in my sharreKitButtonHandler I have the following code:
NSURL *url = [NSURL URLWithString:#"http://www.domain.com"];
SHKItem *shareItem = [SHKItem URL:url title:self.itemTitle.text];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:shareItem];
[actionSheet showFromToolbar:self.shareKitToolbar];
This code prepares some ivars of a shareItem object and in the case of Twitter shareKit manages to fill the status box so that user just needs to press publish and its done...
In the case of Facebook it is not working. FB dialog pops out and the share box is empty saying "What's on your mind?" The url and the title are not put into the publish form?
So, please if you have any clue what's going on in the latter problem or how to solve the former problem, I would really appreciate your help...
It takes five lines to add twitter. I wouldn't bother with Sharekit for that.
TWTweetComposeViewController *tweetView = [[TWTweetComposeViewController alloc] init];
[tweetView addImage:imageToShare;
[tweetView addURL:URLToShare];
[tweetView setInitialText:messageToShare];
[senderViewController presentViewController:tweetView animated:YES completion:nil];
I wanted to use sharekit for my projects, but it was difficult to use and after a week I gave up as I couldn't share more than one thing at the same time (URL, Image, Message, etc.) which is pretty useless if you want to promote your app.
Facebook is more difficult, probably a 100 lines. It took me 3-4 days to implement. It will be integrated in iOS 6 just like Twitter :)