需要有关 mobilesubstrate 调整的帮助
我最近做了一个 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有编译器输出,实际上不可能告诉您缺少什么,编译器输出通常会完整解释给定代码段的问题所在。
您是否在编译器命令行中使用“
-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.
原来我把 - (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/