Reputation: 441
I'm new to Objective-C programming and I want to make a simple tweak about VLC for iOS.app but I can't compile. Here's my code :
#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
I don't find any mistakes in my codes but when I try to compile, theos returns me an error :
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
Have you any clue to make it working ?
Many thanks in advance
Upvotes: 0
Views: 258
Reputation: 155
You don't need to use IBAction with Theos, as you don't use Interface Builder. IBAction is only a way to tell Xcode and Interface Builder to link UI elements to your code. Replacing -(IBAction)playPause by -(void)playPause should work
Upvotes: 2