需要有关 mobilesubstrate 调整的帮助

发布于 2024-11-19 08:51:42 字数 2358 浏览 4 评论 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薄凉少年不暖心 2024-11-26 08:51:42

如果没有编译器输出,实际上不可能告诉您缺少什么,编译器输出通常会完整解释给定代码段的问题所在。
您是否在编译器命令行中使用“-lactivator”与 libactivator 链接?
UIKit 和 Foundation 怎么样?

我们不是通灵的。我们无法比实际向您提供错误消息的编译器更简洁地告诉您缺少什么。

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.

枫林﹌晚霞¤ 2024-11-26 08:51:42

原来我把 - (void)activator 命名错误了
接收事件的东西。而且该代码是一个非常早期的版本,现在运行得很好。

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

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文