Can
Can

Reputation: 4726

How to correctly use iOS Runtime Headers in Xcode?

How can I correctly use the iOS runtime headers inside Xcode for apps that won't make it to the App Store but just for personal hacking?

For example, do I copy the frameworks to /System/Library on my Mac or just include the required dumped runtime-headers to my Xcode project? If so how can I make the including work since when included, I get a ton of error messages. I am drawing a blank here.

There is some stuff on the web but nothing clearly stated. A detailed explanation would be much appreciated!

Thanks.

Upvotes: 1

Views: 1645

Answers (1)

Karim H
Karim H

Reputation: 1631

First lets start by how to link those frameworks

lets assume you want to use SpringBoardServices framework

  1. go to https://github.com/nst/iOS-Runtime-Headers/ and download the headers

  2. search for SpringBoardServices.framework folder and copy all headers inside

  3. go to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/PrivateFrameworks/SpringBoardServices.framework and create a folder named Headers

replace iPhoneOS.platform with iPhoneSimulator.platform an paste the headers in simulator SDK folder too if you want to try apps on the simulator

  1. paste the files you just copied inside

Now you can link the SpringBoardServices Framework

Now how to use SpringBoardServices

This will open the mail application

#include <SpringBoardServices/SpringBoardServices.h>
void openMailApp(){
    SBSLaunchApplicationWithIdentifier(CFSTR("com.apple.MobileMail"), false);
};

To get the name of the app that currently playing music use

SBSCopyNowPlayingAppBundleIdentifier();

Upvotes: 2

Related Questions