2014-01-06 86 views
4

我正在嘗試讓OSOS小牛隊工作。我最近購買了iPhone 5s,然後越獄了。現在我正在嘗試讓Theos工作,以便我可以再次開始一些調整。我曾在OSX Lion和IOS 5和6上工作過。我有一個非常簡單的程序,應用程序啓動時應顯示UIAlert。問題是,當我試圖編譯我的代碼運行make命令我得到這個錯誤:Theos for armv7 and arm64

Making all for tweak test... 
Preprocessing Tweak.xm... 
Compiling Tweak.xm... 
Linking tweak test... 
Undefined symbols for architecture armv7: 
    "_OBJC_CLASS_$_UIAlertView", referenced from: 
     objc-class-ref in Tweak.xm.b0410391.o 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 
make[2]: *** [obj/test.dylib.1cc22e7c.unsigned] Error 1 
make[1]: *** [internal-library-all_] Error 2 
make: *** [test.all.tweak.variables] Error 2 
Williams-MacBook-Pro-2:test williamfsmillie$ 

這裏是我的Tweak.xm代碼:

%hook SBApplicationIcon 

-(void)launch{ 
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"message...." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show]; 
    [alert release]; 
    %orig; 
} 

%end 

我的生成文件:

export SDKVERSION=7.0 

include theos/makefiles/common.mk 

TWEAK_NAME = test 
test_FILES = Tweak.xm 
ARCHS = armv7 arm64 
test_FRAMEWORKS = UIKit 

include $(THEOS_MAKE_PATH)/tweak.mk 

after-install:: 
    install.exec "killall -9 SpringBoard" 

謝謝!

+0

Theos是Theodores的縮寫,不是嗎?誰知道!? –

回答

5

編輯下載一套新的生成文件,並插入頂部以下內容:

export ARCHS = armv7 armv7s arm64 
export TARGET = iphone:clang:7.0:7.0 

另外,與你的調整鏈接Foundation框架。

+0

嗯...編譯好,但UIAlert不會出現。有任何想法嗎? – user3163990

1

如果您使用的是iOS 7,則必須使用正確的方法:嘗試-(void)launchFromLocation:(int)location

因爲它使用的參數,你的代碼應該是這樣的:

-(void)launchFromLocation:(int)location { 
    // your stuff 
    %orig(location); 
} 
+0

對不起,我並不是故意投票,但是我不會允許改變我的投票。啞。 –

+1

Upvoted取消@ alexgray的偶然downvote。 –

2

要解決該警報的問題,你必須包括的UIKit/UIKit.h(對不起,我不能評論)

1

您需要通過添加包括在您的Makefile UIKit框架XXX_FRAMEWORKS = UIKit的其中XXX爲您的項目名稱

3

這是一個老問題,但我仍然FIGUR我應該回答那些有同樣問題的人。你需要調用objc_getClass爲它工作,像這樣:

UIAlertView *alert = [[objc_getClass("UIAlertView") alloc] initWithTitle:@"TEST" message:@"message...." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 

請注意,這不是必需的賦值的左手邊。

+2

你也可以用'%c(UIAlertView)'而不是'objc_getClass(「UIAlertView」)' – kabiroberai