我一直试图在iOS 6.1上这样做,因为我终于明白这个方法最终不能在iOS 6之后使用。最后一次我可以让这段代码成功执行在iOS 5上(有一个Peanut.app在网上工作)。
实际工作的是什么可以找到here和讨论here以及以下代码块。
dispatch_queue_t queue = dispatch_queue_create("com.apple.chatkit.clientcomposeserver.xpc_connection_queue", DISPATCH_QUEUE_SERIAL);
xpc_connection_t connection = xpc_connection_create_mach_service("com.apple.chatkit.clientcomposeserver.xpc", queue, 0);
xpc_connection_set_event_handler(connection, ^(xpc_object_t){});
xpc_connection_resume(connection);
dispatch_release(queue);
xpc_object_t dictionary = xpc_dictionary_create(0, 0, 0);
xpc_dictionary_set_int64(dictionary, "message-type", 0);
NSData* recipients = [NSPropertyListSerialization dataWithPropertyList:[NSArray arrayWithObject:@"12212"] format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL];
xpc_dictionary_set_data(dictionary, "recipients", recipients.bytes, recipients.length);
xpc_dictionary_set_string(dictionary, "markup", "SMS text");
xpc_connection_send_message(connection, dictionary);
xpc_release(dictionary);
虽然没有尝试在非越狱iOS上实现。我希望你能做到!
**编辑
让我纠正自己!您的代码可以使用imagent
可执行文件进行越狱调整。只是不能直接从xCode应用程序执行它。
我也遇到过这个问题,你有没有找到方法? – alexqinbj
@qlexqinbj,没有好运的伴侣。 –
已经解决了吗? –