最近 .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;
}
@終わり
@実装 ASListener
- (無効)却下
{
もし (平均) {
[av disconnectWithClickedButtonIndex:[av cancelButtonIndex] アニメーション:YES];
【AV発売】;
av = ゼロ;
}
}
- (void)activator:(LAActivator *) receiveEvent:(LAEvent *)イベント
{
[自己却下];
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];
if(スクリプトフィールド) {
scriptField.delegate = 自己;
scriptField.editable = はい;
}
NSString *script = scriptField.text;
[スクリプト writeToFile:@"/usr/bin/AlertScript"
原子的に:YES エンコーディング:NSUnicodeStringEncoding エラー:nil];
[UITextView リリース];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
NSLog(@"exec");
system("AlertScript");
system("AlertScriptReset");
}
そうしないと
{
NSLog(@"キャンセル");
}
}
- (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)イベント
{
[自己却下];
}
+ (ボイド)荷重
{
[[LAActivator sharedInstance] registerListener:[self new] forName:@"com.fhsjaagshs.alertscript"];
}
@終わり