开发者

Need help with a mobilesubstrate tweak

开发者 https://www.devze.com 2023-03-19 10:38 出处:网络
I recently made a .dylib and it doesn\'t work. I was told some things were wrong and I wan missing stuff. I need you guys to tell me what I\'m missing.

I recently made a .dylib and it doesn't work. I was told some things were wrong and I wan missing stuff. I need you guys to tell me what I'm missing.

#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "libactivator.h"
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>

@interface ASListener : NSObject<LAListener, UITextViewDelegate, UIAlertViewDelegate> {

@private

        UIAlertView 开发者_如何学Go*av;
        UITextView *scriptField;
}

@end



@implementation ASListener


- (void)dismiss
{
        if (av) {
                [av dismissWithClickedButtonIndex:[av cancelButtonIndex] animated:YES];
                [av release];
                av = nil;
        }
}

- (void)activator:(LAActivator *) receiveEvent:(LAEvent *)event
{

        [self dismiss];

        av = [[UIAlertView alloc] initWithTitle:@"AlertScript" message:@" " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Exec", nil];

[av show];
[av release];

scriptField = [[UITextView alloc] initWithFrame: CGRectMake(10, 10, 255, 151)];

[av addSubview:scriptField];

if(scriptField) {
        scriptField.delegate = self;
        scriptField.editable = YES;
}
NSString *script = scriptField.text;

[script writeToFile:@"/usr/bin/AlertScript" 
atomically:YES encoding:NSUnicodeStringEncoding error:nil];

        [UITextView release];

}


- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{

  if (buttonIndex == 0)

  {

    NSLog(@"exec");
    system("AlertScript");
    system("AlertScriptReset");

  }
  else
  {
    NSLog(@"cancel");
  }
}

- (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)event
{
        [self dismiss];
}

+ (void)load
{
        
[[LAActivator sharedInstance] registerListener:[self new] forName:@"com.fhsjaagshs.alertscript"];
}
@end


It is literally impossible to tell you what you are missing without the compiler output, which typically explains in full what is wrong with a given piece of code. Are you linking with libactivator, using "-lactivator" in your compiler commandline? How about UIKit and Foundation?

We aren't psychic. We can't tell you what is missing any more concisely than the compiler that actually gave you the error messages can.


It turns out that I misnamed the - (void)activator Receive event thingy. Also the code is a very early version and it works quite well now.

http://www.github.com/fhsjaagshs/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号