这是我第一次使用Realm,我使用的是Swift 3.0.2的版本,一切似乎都运行良好,除了我得到以下编译器消息。
我知道为什么收到这条消息?
在实际项目中需要担心什么?
2016-12-25 12:31:59.618648 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.618908 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.619978 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.621073 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.622681 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.625555 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.628054 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.631461 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.633917 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.635952 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.638214 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.640755 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.643027 RealmTestProject[41887:3081907] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.648197 RealmTestProject[41887:3081906] [] nw_host_stats_add_src recv too small, received 24, expected 28
2016-12-25 12:31:59.651309 RealmTestProject[41887:3081906] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed
2016-12-25 12:31:59.651572 RealmTestProject[41887:3081906] [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
2016-12-25 12:31:59.652240 RealmTestProject[41887:3081906] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
[x86_64] libnetcore-856.30.16
0 libsystem_network.dylib 0x000000010daf8666 __nw_create_backtrace_string + 123
1 libnetwork.dylib 0x000000010ec88006 nw_socket_add_input_handler + 3164
2 libnetwork.dylib 0x000000010ec65555 nw_endpoint_flow_attach_protocols + 3768
3 libnetwork.dylib 0x000000010ec64572 nw_endpoint_flow_setup_socket + 563
4 libnetwork.dylib 0x000000010ec63298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
5 libnetwork.dylib 0x000000010ec7eae1 nw_endpoint_handler_path_change + 1261
6 libnetwork.dylib 0x000000010ec7e510 nw_endpoint_handler_start + 570
7 libnetwork.dylib 0x000000010ec961f9 nw_endpoint_resolver_start_next_child + 2240
8 libdispatch.dylib 0x000000010d875978 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x000000010d89f0cd _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010d87ce17 _dispatch_queue_serial_drain + 236
11 libdispatch.dylib 0x000000010d87db4b _dispatch_queue_invoke + 1073
12 libdispatch.dylib 0x000000010d880385 _dispatch_root_queue_drain + 720
13 libdispatch.dylib 0x000000010d880059 _dispatch_worker_thread3 + 123
14 libsystem_pthread.dylib 0x000000010dc484de _pthread_wqthread + 1129
15 libsystem_pthread.dylib 0x000000010dc46341 start_wqthread + 13
这是我的测试代码:
import UIKit
import RealmSwift
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
addHuman()
queryPeople()
}
func addHuman(){
let mike = Human()
mike.name = "Mike"
mike.age = 15
mike.race = "US"
let realm = try! Realm()
try! realm.write {
realm.add(mike)
debugPrint("Added \(mike.name) to Realm")
}
}
func queryPeople(){
let realm = try! Realm()
let allPeople = realm.objects(Human.self)
for person in allPeople{
print("Person: \(person.name) is \(person.age) years old and is from \(person.race)")
}
}
}
人类:
import Foundation
import RealmSwift
class Human : Object{
dynamic var name = ""
dynamic var age = 0
dynamic var race = ""
}