带有launchd的守护进程没有收到呼叫状态

时间:2012-03-30 10:56:33

标签: ios launchd core-telephony

虽然定义了处理程序内联方法,但我的iOS守护程序不会接收调用状态更新。在我看来,程序没有进入事件循环。你有没有人在iOS上有过守护进程的经验,如果有的话,你能帮助我吗?这是我得到的(用适当的编译器编译它,将它与必要的库和框架链接):

@interface CLAppDelegate : NSObject<UIApplicationDelegate>{
}
@end

@implementation CLAppDelegate

- (id) init
{
    self = [super init];
    if (self != nil)
    {
        NSLog(@"AppDelegate created!");
        return self;
    }
    NSLog(@"Somehow i lost my pants.");
    return nil;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"Application launched.");
    CTCallCenter* callCenter = [[CTCallCenter alloc]init];
    callCenter.callEventHandler = ^(CTCall* inCTCall) {
        dispatch_async(dispatch_get_main_queue(), ^{
        NSLog(@"CallState: %@", [inCTCall callState]);
    });
};
return YES;
}
@end

int main(int argc, char* argv[]) {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    NSLog(@"Hello iPhone! (with app delegate)");
    NSString* _appdelegateclassname = NSStringFromClass([CLAppDelegate class]);
    NSLog(@"AppDelegate class name: %@", _appdelegateclassname);
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://www.smr.name"]];
    int retVal = UIApplicationMain(argc, argv, nil, _appdelegateclassname);
    [pool release];
    return retVal;
}

它编译和链接,甚至运行(OpenSSH到iPhone) - 但从不显示CallState日志。 哦,还有没有可能从该守护进程运行另一个应用程序(在/ User / Applications /文件夹中)?

0 个答案:

没有答案