Search code examples
iphoneiosjailbreak

How do I pass options (to didFinishLaunchingWithOptions) to the app I activate from my tweak?


I have a tweak that's loaded into SpringBoard and activates an app specified from external sources.

How do I pass any arguments to the app I activate? SBUIController::activateApplicationFromSwitcher() doesn't seem to have any provisions to to that, as well as SBApplication.

Background: I need to pass a file:// url to mobile safari. I've got file:// for mobile safari tweak installed, however it doesn't register file:// scheme with mobile safari, so openURL doesn't work.

Another option would be to extend mobile safari by teaching it how to respond to file:// urls. Can't seem to find what I need to hook for that.


Solution

  • It is possible to do this. First, you have to edit MobileSafari's Info.plist so that file:// is added to the url schemes. Second, you have to override the application:openURL: method with mobilesubstrate to handle this address. This will require some reverse engineering to figure out how to do correctly, but it can be done.