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 \
[email protected]: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 \
[email protected]: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 \
[email protected]: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.
=======
In your Terminal:
pip install argparse
pip install flask
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 Dialect
isGNU++11
orC++11
-
Ensure
C++ Standard Library
islibc++
Search for header
- Add relative or full path to
hookshot/Classes
toHeader Search Paths
Search for preprocessor
- Add
HOOKSHOT_ENABLED=1
toPreprocessor Macros
for yourDebug
target(s)
Select your root project. For each the target you want to use hookshot with
-
Select
Build Phases
-
Open the
Link Binary With Libraries
panel
-
Add
libhookshot.a
-
Add
libc++.dylib
You're now ready to start using hookshot!
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
HookshotEnable
and set it toYES
More information on how to use hookshot in your code is available in the README.