Search code examples
iphoneiosjailbreak

Mobilesubstrate MobileSafari tweak Logos compilation issue


I'm trying to trap the arguments of the function in bookmarking on MobileSafari. But I get compile errors. I suspect the WebBookmark class is undeclared and found none of the headers in Safari declaring the interface for it. So I added:

#import <WebKit/WebKit.h>
#import <WebCore/WebCore.h>

To my Tweak.mk. Does anyone know where to find their interfaces? Below are my makefiles, tweak and output. Thanks!

# output:
Making all for tweak TestingTweak...
 Preprocessing Tweak.xm...
 Compiling Tweak.xm...
In file included from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UITableView.h:11,
                 from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPickerView.h:11,
                 from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibilityAdditions.h:10,
                 from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccessibility.h:12,
                 from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:10,
                 from /opt/theos/Prefix.pch:4,
                 from <command-line>:0:
/opt/theos/include/UIKit/UISwipeGestureRecognizer.h:6:26: error: Availability2.h: No such file or directory
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: ‘WebBookmark’ has not been declared
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:30: error: expected initializer before ‘*’ token
Tweak.xm:464: error: ‘WebBookmark’ has not been declared
Tweak.xm:465: error: expected initializer before ‘*’ token
Tweak.xm:466: error: ‘WebBookmark’ has not been declared
Tweak.xm:467: error: expected initializer before ‘*’ token
Tweak.xm: In function ‘void _logosLocalInit()’:
Tweak.xm:2569: error: ‘_logos_method$_ungrouped$FolderPickerViewController$parentBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_orig$_ungrouped$FolderPickerViewController$parentBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_method$_ungrouped$FolderPickerViewController$movingBookmark’ was not declared in this scope
Tweak.xm:2569: error: ‘_logos_orig$_ungrouped$FolderPickerViewController$movingBookmark’ was not declared in this scope
make[2]: *** [obj/Tweak.xm.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [TestingTweak.all.tweak.variables] Error 2
WHAt went in:
#import <UIKit/UIKit2.h>

%hook FolderPickerViewController
- (id)initWithDelegate:(id)arg1 bookmarkCollection:(id)arg2 { %log; id r = %orig; NSLog(@" = %@", r); return r; }
- (void)dealloc { %log; %orig; }
- (int)tableView:(id)arg1 numberOfRowsInSection:(int)arg2 { %log; int r = %orig; NSLog(@" = %d", r); return r; }
- (id)tableView:(id)arg1 cellForRowAtIndexPath:(id)arg2 { %log; id r = %orig; NSLog(@" = %@", r); return r; }
- (void)tableView:(id)arg1 didSelectRowAtIndexPath:(id)arg2 { %log; %orig; }
- (void)_cancel { %log; %orig; }
- (void)willShowForBookmark:(id)arg1 parent:(id)arg2 { %log; %orig; }
// the following properties seem to be the culprit
- (void)setParentBookmark:(WebBookmark *)parentBookmark { %log; %orig; }
- (WebBookmark *)parentBookmark { %log; WebBookmark * r = %orig; NSLog(@" = %@", r); return r; }
- (void)setMovingBookmark:(WebBookmark *)movingBookmark { %log; %orig; }
- (WebBookmark *)movingBookmark { %log; WebBookmark * r = %orig; NSLog(@" = %@", r); return r; }

%end

What's in the makefile:

SDKVERSION=5.0
include theos/makefiles/common.mk

TWEAK_NAME = TestingTweak
TestingTweak_FILES = Tweak.xm

include $(THEOS_MAKE_PATH)/tweak.mk

Filter:

{ Filter = { Bundles = ( "com.apple.mobilesafari" ); }; }

Solution

  • WebBookmark comes from WebBookmarks.framework. It's a private framework, you'll have to class-dump it.