如何从NSNotification回复Python?

时间:2013-05-01 18:30:53

标签: python objective-c

我使用以下代码从Python调用Obj:

    print "Login begin";
    nc = Foundation.NSDistributedNotificationCenter.defaultCenter();
    userInfo = NSDictionary.dictionaryWithObjectsAndKeys_("7","operation",user,"username",password,"password",None);    
    nc.postNotificationName_object_userInfo_deliverImmediately_(SIMULATOR_NOTIFICATION,"",userInfo,1);
    return;

ObjC如此收到:

- (void) recievedNotification:(NSNotification *) notification
{
    NSDictionary *userInfo = [notification userInfo];
    NSControl *postingObject = [notification object]; // the object that posted the notification
    NSMutableDictionary *response = [NSMutableDictionary dictionaryWithCapacity:1];

    int switcher = [[userInfo objectForKey:@"operation"] intValue];

    switch (switcher) {            

我的问题是:如何将值(例如成功/失败布尔值)返回给我的Python代码?

顺便说一句,这不是我的代码,是的,我可以看到它的各种问题,但那个开发者离开了,现在我被要求更新它。你知道它是怎么回事。

0 个答案:

没有答案