【问题标题】:Theos tweak: helloworld alert box did not show upTheos 调整:helloworld 警告框没有出现
【发布时间】:2013-08-08 06:55:15
【问题描述】:

我关注了http://brandontreb.com/beginning-jailbroken-ios-development-building-and-deployment 进行调整。一切似乎都很好,ma​​ke package install 成功了,
但是当我的 iPhone 重新启动时,“helloworld”框并没有出现, 有大神知道怎么解决吗?

我的 xcode 是 4.6,安装的是 sdk5.1
我的 iPhone 是 iOS6.1.2

我设置了那些

export THEOS=/opt/theos/
export SDKVERSION=5.1
export THEOS_DEVICE_IP=192.168.1.101

这是 Makefile

export ARCHS=armv7
export TARGET=iphone:5.1
include $(THEOS)/makefiles/common.mk
helloworld_FRAMEWORKS = UIKit
TWEAK_NAME = helloworld
helloworld_FILES = Tweak.xm
include $(THEOS)/makefiles/tweak.mk

这是 Tweak.xm

#import <SpringBoard/SpringBoard.h>

%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application {
%orig;

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome"
    message:@"Hello world"
    delegate:nil
    cancelButtonTitle:@"123"
    otherButtonTitles:nil];
    [alert show];
    [alert release];
}

%end

【问题讨论】:

  • 所以你把你的代码放在makefile而不是源文件中...helloworld_FILES = Tweak.xmNOTtweak.mk...
  • 编辑错误,谢谢
  • @userXXX 然后将applicationDidFinishLaunching:(id)application 更改为application:(id)app didFinishLaunchingWithOptions:(id)opt

标签: jailbreak tweak theos


【解决方案1】:

我想通了,*.plist 应该是
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

感谢@H2CO3,我在其他地方找到了您的评论
但是在我成功完成 helloworld 调整之后。
我使用MSHookFunction 钩住fopen

然后我遇到了链接错误

Making all for tweak hw...
 Preprocessing Tweak.xm...
 Compiling Tweak.xm...
 Linking tweak hw...
Undefined symbols for architecture armv7:
  "_MSHookFunction", referenced from:
      global constructors keyed to Tweak.xm.mmin Tweak.xm.51941273.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make[2]: *** [.theos/obj/hw.dylib.ba964c90.unsigned] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [hw.all.tweak.variables] Error 2

这是 Tweak.xm

#import "substrate.h"

static FILE * (*s_orig_fopen) ( const char * filename, const char * mode );
static FILE * my_fopen ( const char * filename, const char * mode ){
    return s_orig_fopen(filename, mode);
}

static void entry(void)  __attribute__ ((constructor));
static void entry(void) {
    MSHookFunction(fopen, my_fopen, &s_orig_fopen);
}

【讨论】:

    猜你喜欢
    • 2013-08-12
    • 2021-12-27
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 2018-07-21
    • 2019-10-11
    • 2011-04-08
    • 1970-01-01
    相关资源
    最近更新 更多