这个调整有什么问题?

时间:2012-09-12 13:19:00

标签: iphone ios xcode cydia tweak

我尝试使用theos编译一个调整,这是一个惊人的框架,可以在许多不同的平台上轻松创建调整。在这里,我试图在每次调用时显示一个设置图标,然后慢慢将其淡出,但是无法编译。我有所有需要的标题和框架,我正在运行一个真正的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/BlobIcon@2x.png"], 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

makefile看起来像这样:

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$ 

我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

问题是mainImageView尚未声明为任何内容......

只需UIImageView *mainImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"/Applications/Preferences.app/BlobIcon@2x.png"]];

除非您尝试移动已经位于锁定屏幕上的对象,例如时钟,在这种情况下,您需要找出对象是什么,使用#import将其包含在文件中然后像你一样动画它。