IBAction在theos编译时出错

时间:2014-01-26 18:29:31

标签: ios7 hook cydia tweak theos

我是Objective-C编程的新手,我想对iOS.app进行VLC的简单调整,但我无法编译。 这是我的代码:

#import <UIKit/UIKit.h>

%hook VLCMovieViewController

-(IBAction)playPause
{
    if([_mediaPlayer isPlaying]) {
        UIAlertView *pause = [[UIAlertView alloc] initWithTitle:@"PAUSED" message:@"Your movie is paused" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK !", nil];
        [_listPlayer pause];
        [pause show];
        [pause release];
    }
    else
    {
        UIAlertView *play = [[UIAlertView alloc] initWithTitle:@"PLAYING" message:@"Your movie is playing" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK !", nil];
        [_listPlayer play];
        [play show];
        [play release];
    }
}

%end

我的代码中没有发现任何错误,但是当我尝试编译时,theos会给我一个错误:

Preprocessing Tweak.xm...
Compiling Tweak.xm...
Tweak.xm:6:8: error: expected unqualified-id
static IBAction (*_logos_orig$_ungrouped$VLCMovieViewController$playPause)(VLCMovieViewController*, SEL); s...
       ^
<built-in :24:22: note: expanded from here
#define IBAction void)__attribute__((ibaction)
                     ^
1 error generated.
make[2]: *** [obj/Tweak.xm.708dff35.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [VLCTweak.all.tweak.variables] Error 2

你有什么线索可以让它发挥作用吗?

非常感谢提前

1 个答案:

答案 0 :(得分:2)

您不需要对Theos使用IBAction,因为您不使用Interface Builder。 IBAction只是告诉Xcode和Interface Builder将UI元素链接到代码的一种方法。 替换 - (IBAction)playPause by - (void)playPause应该起作用