我为基于http://dl.dropbox.com/u/463624/Elevator.zip的应用程序编写了一个帮助工具,但是现在将部署目标设置为10.10我可以在lauch.h中看到弃用,这是代码:
#import <Foundation/Foundation.h>
#import <launch.h>
#import <syslog.h>
#import "HelperTool.h"
int main (int argc, const char * argv[])
{
@autoreleasepool {
syslog(LOG_NOTICE, "MyHelper launched (uid: %d, euid: %d, pid: %d)", getuid(), geteuid(), getpid());
launch_data_t req = launch_data_new_string(LAUNCH_KEY_CHECKIN);
launch_data_t resp = launch_msg(req);
launch_data_t machData = launch_data_dict_lookup(resp, LAUNCH_JOBKEY_MACHSERVICES);
launch_data_t machPortData = launch_data_dict_lookup(machData, "com.me.MyHelper.mach");
mach_port_t mp = launch_data_get_machport(machPortData);
launch_data_free(req);
launch_data_free(resp);
NSMachPort *rp = [[NSMachPort alloc] initWithMachPort:mp];
NSConnection *c = [NSConnection connectionWithReceivePort:rp sendPort:nil];
//.....
}
return 0;
}
在这里看:https://developer.apple.com/library/mac/documentation/General/Reference/APIDiffsMacOSX10_10SeedDiff/headers/System.html没有大的变化,但如何解决?