首页 文章

需要有关mobilesubstrate调整的帮助

提问于
浏览
0

我最近制作了一个.dylib,它不起作用 . 有人告诉我有些事情是错的,我想错过的东西 . 我需要你们告诉我我错过了什么 .

#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 *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

2 回答

  • 0

    如果没有编译器输出,几乎不可能告诉你缺少什么,这通常可以完整地解释给定代码片段的错误 . 您是否在编译器命令行中使用“ -lactivator ”链接libactivator? UIKit和基金会怎么样?

    我们不是通灵者 . 我们不能比实际给你错误消息的编译器更简洁地告诉你什么是缺失的 .

  • 0

    事实证明,我错误地命名 - (void)激活器接收事件 . 此外,代码是一个非常早期的版本,它现在运行得很好 .

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

相关问题