2012-09-12 52 views
0

我試着編譯一個調整使用theos,一個驚人的框架,很容易在許多不同的平臺上創建調整。在這裏,我試圖在每次respring時緩慢顯示一個設置圖標,但它無法編譯。我擁有所有需要的頭文件和框架,並且正在運行一個真正的Mac(儘管名稱在我的終端上看到:P),並安裝了最新的Xcode並安裝了Xcode 4.2。這是tweak.xm:這個調整有什麼問題?

#import <UIKit/UIKit2.h> 
#import <objc/runtime.h> 
#import <SpringBoard/SpringBoard.h> 
#import <Foundation/Foundation.h> 
#import <AudioToolbox/AudioToolbox.h> 
#import <substrate2.h> 
#import <IOSurface/IOSurface.h> 
#import <QuartzCore/QuartzCore2.h> 
#import <CoreGraphics/CoreGraphics.h> 
#import <CaptainHook/CaptainHook.h> 
#import <Foundation/Foundation.h> 
#import <objc/runtime.h> 
#import <AVFoundation/AVAudioPlayer.h> 
#import <Celestial/Celestial.h> 
#import <SpringBoardServices/SpringBoardServices.h> 
#import <CoreFoundation/CFNotificationCenter.h> 
#import <ChatKit/ChatKit.h> 

%hook CKConversationListController 

- (void)composeButtonClicked:(id)clicked { 
} 
%end 

%hook SpringBoard 
-(void)applicationDidFinishLaunching:(id)application { 
NSArray *animationArray = [NSArray arrayWithObjects:[UIImage imageNamed:@"/Applications/Preferences.app/[email protected]"], nil]; 


     [NSTimer scheduledTimerWithTimeInterval:.75 target:self selector:@selector(crossfade) userInfo:nil repeats:YES]; 

    mainImageView.animationImages = animationArray; 


    mainImageView.animationDuration = 4.5; //mainImageView is instance of UIImageView 

    mainImageView.animationRepeatCount = 0; 

    [mainImageView startAnimating]; 


    CABasicAnimation *crossFade = [CABasicAnimation animationWithKeyPath:@"contents"]; 
    crossFade.autoreverses = YES; 
    crossFade.repeatCount = 1; 
    crossFade.duration = 1.0; 
} 

%new 
- (void) crossfade { 
    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:0.5]; 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; // user dependent transition acn be set here 
    mainImageView.alpha = !mainImageView.alpha; 
    [UIView commitAnimations]; 
} 
%end 

而生成文件看起來是這樣的:

include theos/makefiles/common.mk 
export GO_EASY_ON_ME=1 

TWEAK_NAME = Goofy 
Goofy_FILES = Tweak.xm 
Goofy_FRAMEWORKS = Foundation UIKit CoreGraphics ChatKit 
Goofy_PRIVATE_FRAMEWORKS = ChatKit VoiceServices AppSupport 

include $(THEOS_MAKE_PATH)/tweak.mk 

我保持在得到

Making all for tweak Goofy... 
Preprocessing Tweak.xm... 
Compiling Tweak.xm... 
Tweak.xm: In function ‘void _logos_method$_ungrouped$SpringBoard$applicationDidFinishLaunching$(SpringBoard*, objc_selector*, objc_object*)’: 
Tweak.xm:32: error: ‘mainImageView’ was not declared in this scope 
Tweak.xm: In function ‘void _logos_method$_ungrouped$SpringBoard$crossfade(SpringBoard*, objc_selector*)’: 
Tweak.xm:53: error: ‘mainImageView’ was not declared in this scope 
make[2]: *** [.theos/obj/Tweak.xm.o] Error 1 
make[1]: *** [internal-library-all_] Error 2 
make: *** [Goofy.all.tweak.variables] Error 2 
Hackint0sh-HD:Goofy iHackerMe$ 

缺少什麼我在這裏?

+0

我不知道這個工具,但從錯誤消息來看,它看起來像'mainImageView'沒有定義(我沒有看到你在代碼片段中定義它的位置)。 – Rob

+0

那麼我應該如何定義@Rob? – iHackerMe

+0

它看起來應該是'UIImageView'。但事實是,標準程序通常不會在'didFinishLaunchingWithOptions'(通常只有管家類的東西,比如可能初始化'window'和'viewController',設置'window'' s'rootViewController'等),而是在視圖控制器的'viewDidLoad'中。但是你甚至沒有引用視圖控制器,所以我不知道你是否錯過了一些基本的東西,或者Theos框架是否應該爲你處理這些東西。我只是不知道Theos。 – Rob

回答

0

的問題是,mainImageView還沒有被宣佈爲任何事情......

只是做UIImageView *mainImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"/Applications/Preferences.app/[email protected]"]];

除非你想移動的對象是已在鎖定屏幕上喜歡說的時鐘,在這種情況下,您需要找出對象是什麼,使用#import將其包含在文件中,然後像您一樣對其進行動畫處理。