我一直試圖在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,沒有好運的伴侶。 –
已經解決了嗎? –