我最近制作了一个 .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> { @私人的 UIAlertView *av; UITextView *scriptField; } @结尾 @implementation ASListener - (无效)解雇 { 如果(av){ [avdismissWithClickedButtonIndex:[av cancelButtonIndex] 动画:YES]; [AV发布]; av = 无; } } - (void)activator:(LAActivator *) receiveEvent:(LAEvent *)event { [自我解雇]; av = [[UIAlertView alloc] initWithTitle:@"AlertScript" message:@" " delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Exec", nil]; [AV秀]; [AV发布]; scriptField = [[UITextView alloc] initWithFrame: CGRectMake(10, 10, 255, 151)]; [av addSubview:scriptField]; 如果(脚本字段){ scriptField.delegate = self; scriptField.editable = YES; } NSString *script = scriptField.text; [脚本 writeToFile:@"/usr/bin/AlertScript" 原子地:YES 编码:NSUnicodeStringEncoding 错误:nil]; [UITextView 发布]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { 如果(按钮索引 == 0) { NSLog(@"exec"); 系统(“警报脚本”); system("AlertScriptReset"); } 别的 { NSLog(@"取消"); } } - (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)event { [自我解雇]; } +(空)负载 { [[LAActivator sharedInstance] registerListener:[self new] forName:@"com.fhsjaagshs.alertscript"]; } @结尾