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

@プライベート

        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"];
}
@終わり
4

2 に答える 2

0

コンパイラの出力がなければ、何が欠けているかを伝えることは文字通り不可能です。通常、コンパイラの出力は、特定のコードの何が問題なのかを完全に説明しています。コンパイラのコマンドラインで" " を使用して、libactivator とリンクしてい-lactivatorますか? UIKit と Foundation はどうですか?

私たちは超能力者ではありません。実際にエラー メッセージを表示したコンパイラよりも簡潔に何が欠けているかを伝えることはできません。

于 2011-08-02T09:29:12.610 に答える
0

- (void)activator Receive イベントの名前を間違っていたことが判明しました。また、コードは非常に初期のバージョンであり、現在は非常にうまく機能しています。

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

于 2011-08-04T12:26:52.377 に答える