Why doesn't my code integrated with libactivator work in iOS5.x?

237 views Asked by At

I'm going to use libactivator to make the control mechanism in my application. But It doesn't work in iOS5.x while working good in iOS6.x. In my testing code, it will popup an alert to tip when receiveEvent(libactivator.volume.up.press by default).That works in iOS6.x, but doesn't in iOS5.x.There isn't any error, just no effect, and no settings option of this application in the Activator's settings view.

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <libactivator/libactivator.h>


@interface TestActivator : NSObject<LAListener> {
}
@end

@implementation TestActivator



- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
{

    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TestActivator" message:[event name] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [av show];
    [av release];
    [event setHandled:YES];
}

+ (void)load
{
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSString * packID = @"com.example.TestActivator";


        [[LAActivator sharedInstance] registerListener:[self new] forName:packID];
        [[LAActivator sharedInstance] assignEvent:[LAEvent eventWithName:@"libactivator.volume.up.press"] toListenerWithName:packID];

        [pool release];
}

@end
0

There are 0 answers