hookshot installation
January 16, 2013 ยท View on GitHub
Get the code
If you're using git 1.8, you can use git subtree for easy inclusion of the hookshot codebase:
git subtree add --prefix=path/within/repo/for/hookshot --squash \
git@github.com:Cue/hookshot.git master
Later, you can upgrade to the latest revision of hookshot with:
git subtree pull --prefix=path/within/repo/for/hookshot --squash \
git@github.com:Cue/hookshot.git master
If you make changes and want to submit a pull request, fork hookshot, and then:
git subtree pull --prefix=path/within/repo/for/hookshot --squash \
git@github.com:YourGitUsername/hookshot.git master
and then submit your pull request from your forked repo.
Alternately, just download all the files in Classes, bin, and hookshot.xcodeproj and save them in a convenient place.
=======
Install Python dependencies
In your Terminal:
pip install argparse
pip install flask
Add to your project
Open Finder, navigate to hookshot.xcodeproj, and drag it in to your project:

should result in something like this:

Select the subproject, then choose Build Settings. Search for c++
-
Ensure
C++ Language DialectisGNU++11orC++11 -
Ensure
C++ Standard Libraryislibc++

Search for header
- Add relative or full path to
hookshot/ClassestoHeader Search Paths

Search for preprocessor
- Add
HOOKSHOT_ENABLED=1toPreprocessor Macrosfor yourDebugtarget(s)
Select your root project. For each the target you want to use hookshot with
-
Select
Build Phases -
Open the
Link Binary With Librariespanel

-
Add
libhookshot.a -
Add
libc++.dylib

You're now ready to start using hookshot!
Instrument your code
We recommend adding instrumentation in your AppDelegate class's initialize method:
+ (void)initialize;
{
if (self != [AppDelegate class]) {
return;
}
if ([[[[NSProcessInfo processInfo] environment] objectForKey:@"HookshotProfile"] isEqualToString:@"YES"]) {
HOOKSHOT_PROFILE_CLASS(self);
HOOKSHOT_PROFILE_CLASS([UIWebView class]);
}
}
We use the environment variable strategy shown above to almost completely eliminate the cost of hookshot when you aren't using it. hookshot is an instrumenting profiler, so when it's on your application will run slower (probably noticeably slower).
The good news: most of hookshot is installed at runtime (see above), so you can enable or disable it with an environment variable.
We recommend creating a special scheme for running with profiling turned on. We use a scheme instead of a target because it's much faster to switch between the two (no re-indexing in XCode!).
-
Click
Product>Manage Schemes -
Duplicate your main scheme
-
Rename it to something like "(your scheme name) with hookshot"
-
Add an environment variable named
HookshotEnableand set it toYES


More information on how to use hookshot in your code is available in the README.