0

IPC を使用して相互に通信する 2 つのアプリを開発しました。サーバー側とクライアント側のコードは次のとおりです。

サーバ:

_distantObject = [[DistantObject alloc] init];
        
NSPort *serverPort = [NSMachPort port];
_proxyConnection = [[NSConnection alloc] initWithReceivePort:serverPort sendPort:serverPort];
[_proxyConnection setRootObject:_distantObject];
        
if (![_proxyConnection registerName:@"MyServer"]) {
            
   NSLog(@"ERROR: starting MyServer");
}

クライアント:

    DistantObject *remoteObject;
    NSConnection *theConnection = [NSConnection connectionWithRegisteredName:@"MyServer"
                                                                        host:nil];
    if (theConnection != nil) {
        
        remoteObject = (DistantObject *)[theConnection rootProxy];
        remoteObject.someValue = value;
    }

問題は、OS X 10.6 で動作しないことです。ただし、10.7、10.8、および 10.9 では完全に動作します。10.6 で受け取るエラーは次のとおりです。

__NSAutoreleaseNoPool(): クラス NSCFDictionary のオブジェクト 0x10031a0f0 がプールなしで自動解放されました - ちょうどリークしています

__NSAutoreleaseNoPool(): クラス NSCFArray のオブジェクト 0x100330b50 がプールなしで自動解放されました - リークしているだけです

その結果、クライアントは適切な値を渡しません。

4

0 に答える 0