2

I want to launch "Photos" application (the stock apple one) through a jailbreak tweak. I have hooked the springboard, overridden the methods I need and now I need to launch the "Photos" app. My problem is, there's no URL set up for it. So how do I do it? Thanks in advance! :)

#import <UIKit/UIKit.h>
#import <substrate.h>
#import <SBApplication.h>

@interface UIApplication (ScreenShooter)
//-(void)applicationOpenURL:(id)url;
@end

%hook SBScreenFlash

-(void)stopFlash {
%orig;
//[[UIApplication sharedApplication] applicationOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"com.apple.mobileslideshow"]]];

SBApplication *app = [[objc_getClass("SBApplicationController") sharedInstance] applicationWithDisplayIdentifier:@"com.apple.mobileslideshow"];
[[objc_getClass("SBUIController") sharedInstance] activateApplicationFromSwitcher: app];
}
%end
Nate
  • 31,017
  • 13
  • 83
  • 207
  • If you're inside of SpringBoard already, I think [this answer will work](http://stackoverflow.com/a/11693879/119114). If not, then [try this solution](http://stackoverflow.com/a/15455831/119114), using the bundle identifier of `com.apple.mobileslideshow`. I assume you meant to say the **Photos** app, not the **Images** app ... or maybe iOS shows **Images** in the language you use (?). – Nate Apr 29 '13 at 09:14
  • Thank you for your answer! You are right, I meant Photos app. :) I tried the answer by WrightsCS in the first link but I get errors. It can't seem to locate SBApplication... I am probably missing an import somewhere but I can't fix it. Any ideas? – Nick Aliferopoulos Apr 29 '13 at 09:43
  • Well, `SBApplication` would be a private API, so you'll need to use something like `class-dump` to generate those headers, or just search online a bit for `SBApplication.h`, and include it in your project. – Nate Apr 29 '13 at 09:45
  • Found it, but it seems to import Foundation.h and CoreGraphics.h. Do I need to also include those? Isn't this done automatically by theos? – Nick Aliferopoulos Apr 29 '13 at 09:48
  • Try to compile it, and see. If it compiles, you're good. If not, then you'll need to solve that problem ... unfortunately, I don't use theos myself, so can't help you there. – Nate Apr 29 '13 at 09:49
  • The exact error is: "SBApplication was not declared in this scope." That means I didn't import it, right? – Nick Aliferopoulos Apr 29 '13 at 09:56
  • I managed to get it to compile, but it doesn't do what it is supposed to. I will update the original post to contain my code. – Nick Aliferopoulos Apr 29 '13 at 11:51
  • Never mind I actually got it to work by importing the missing header! :) – Nick Aliferopoulos Apr 29 '13 at 20:27

0 Answers0