书上49页例子的问题

我目前xcode5.1.1只有iOS7 sdk,越狱机是6.1.6的itouch,把makefile里面的TARGET = iphone:7.1:4.3改好,能安装成功,会自动重启,但是就是不会alert,请问是什么原因呢?

付上Tweak.xm完整代码

%hook SpringBoard 
 -(void)applicationDidFinishLaunching:(id)application { 
%orig; 
 UIAlertView *alert = [UIAlertView alloc] 
initWithTitle:@"Welcome"  message:@"hihi~"  
delegate:nil cancelButtonTitle:@"Thanks"  
otherButtonTitles:nil];
[alert show]; 
[alert release];
 } 
 %end

难道只能用sdk6.1来编译吗?

没事了,解决了,居然手残把bundle id打错了一个字母。。。:mad:

同样的问题啊,bundle id检查了,没有输入错
5S 7.1.2,按书上一直下来都安装成功了,但是就是不弹出UIAlert

Makefile:
include theos/makefiles/common.mk

ARCHS = armv7 (这里armv7s以及armv7s arm64都试过了,还是不行)
TARGET = iPhone:7.1:4.3 (这里也试了7.1:7.1也不行)
TWEAK_NAME = tweakTest1
tweakTest1_FILES = Tweak.xm
tweakTest1_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
install.exec “killall -9 SpringBoard”

求大大指导一下

改成

改了,还是没有弹出UIAlert,求大大帮忙看看

Makefile:
include theos/makefiles/common.mk

ARCHS = arm64
TARGET = iPhone:7.1:7.0
TWEAK_NAME = tweakTest1
tweakTest1_FILES = Tweak.xm
tweakTest1_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
install.exec “killall -9 SpringBoard”

====================== 我是分割线 ===========
control:
Package: com.yourcompany.tweaktest1
Name: tweakTest1
Depends: mobilesubstrate
Version: 1.0.0
Architecture: iphoneos-arm
Description: SB你好,SB拜拜。
Maintainer: kevin
Author: kevin
Section: Tweaks
Homepage: http://www.kbnix.com

=================== 我是分割线 ================

Tweak.xm:
%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application
{
%orig;
%log((NSString*)@“hook成功啦,弹出来了没?”);
UIAlertView *alert = [UIAlertView alloc] initWithTitle:@“Hello World” message:nil delegate:self cancelButtonTitle:@“OK” otherButtonTitles:nil];
[alert show];
[alert release];
}
%end

================ 我是分割线 ===============

tweakTest1.plist
{ Filter = { Bundles = ( “com.apple.springboard” ); }; }

手机上的系统日志里有这个提示:
Aug 15 16:00:01 Kevin-5s SpringBoard[3025] : MS:Error: dlopen(/Library/MobileSubstrate/DynamicLibraries/tweakTest1.dylib, 9): no suitable image found. Did find:
/Library/MobileSubstrate/DynamicLibraries/tweakTest1.dylib: mach-o, but wrong architecture

解决了:
在/etc/profile里增加了两行声明就行了

export SDKVERSION=7.1
export ARCHS=armv7 armv7s arm64