Я недавно сделал .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