I'm actually learning swift and I'm testing the switch control flow. I try this code on IBM Swift Sandbox:
let const = "Z"
switch const {
case "a" ,
"A": print("La primera letra del abecedario")
case "z": print("La ultima letra del abecedario")
default: print("NPI de que letra se trate")
}
It all works fine, tested with const = {"a","A","f","z"}. But when const is "Z" i get this error:
terminate called after throwing an instance of 'std::system_error'
what(): Resource temporarily unavailable
0 swift-build-tool 0x000000000050bade llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1 swift-build-tool 0x000000000050ca49
2 swift-build-tool 0x000000000050cd53
3 libpthread.so.0 0x00007f960ca22330
4 libc.so.6 0x00007f960bc5fc37 gsignal + 55
5 libc.so.6 0x00007f960bc63028 abort + 328
6 libstdc++.so.6 0x00007f960c56a535 __gnu_cxx::__verbose_terminate_handler() + 341
7 libstdc++.so.6 0x00007f960c5686d6
8 libstdc++.so.6 0x00007f960c568703
9 libstdc++.so.6 0x00007f960c568922
10 libstdc++.so.6 0x00007f960c5ba800 std::__throw_system_error(int) + 128
11 libstdc++.so.6 0x00007f960c5bbd68 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) + 584
12 swift-build-tool 0x0000000000494d6d
13 swift-build-tool 0x0000000000494b0d
14 swift-build-tool 0x0000000000494a01 llbuild::buildsystem::createLaneBasedExecutionQueue(llbuild::buildsystem::BuildExecutionQueueDelegate&, int) + 49
15 swift-build-tool 0x0000000000490ba8 llbuild::buildsystem::BuildSystemFrontendDelegate::createExecutionQueue() + 264
16 swift-build-tool 0x00000000004b98e9
17 swift-build-tool 0x00000000004b9823 llbuild::buildsystem::BuildSystem::build(llvm::StringRef) + 67
18 swift-build-tool 0x000000000049150d llbuild::buildsystem::BuildSystemFrontend::build(llvm::StringRef) + 1405
19 swift-build-tool 0x000000000048e086
20 swift-build-tool 0x000000000048dc7a main + 170
21 libc.so.6 0x00007f960bc4af45 __libc_start_main + 245
22 swift-build-tool 0x000000000048db04
swift-build: error: Child process exited with signal
Trying your code in the Sandbox now, it looks like it works just fine with const = "Z". This was an error on the Sandbox end, it looks like. We were having issues with a handful of our servers over the holidays, and we're working on getting them fixed. Your code seems to be correct.
Related
I am trying to upload my independent watchOS App on my real Apple Watch series 5, but I am having a problem. I am receiving a issue that I telling me:
Unable to install "FirstTestWatch WatchKit App"
Domain: com.apple.dtdevicekit
Code: -402620395
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402620395
Failure Reason: A valid provisioning profile for this executable was not found.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x00000001261406e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x0000000126140de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x000000012618056a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x000000010d00bc22 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x0000000126180301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x0000000126008a25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x000000010d13ce8a __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x000000010d13e562 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff70480583 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff7048150e _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff70486ace _dispatch_lane_serial_drain + 597
11 libdispatch.dylib 0x00007fff70487452 _dispatch_lane_invoke + 363
12 libdispatch.dylib 0x00007fff70490a9e _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff706db6fc _pthread_wqthread + 290
14 libsystem_pthread.dylib 0x00007fff706da827 start_wqthread + 15
);
}
--
I am trying to figure out the problem, but I am having difficulties. The Apple Watch is with watchOS 6.1.1, MAC BOOK - macOS Catalina 10.15.2 and Xcode 11.3. Thank you!
I solved this problem today after getting stuck for two days.
Download watchOSLogging.mobileconfig to the paired iPhone and install it.
I am using Kotlin multiplatform to build framework for iOS, and everything works well except the strange issue.
The code from Kotlin:
fun example(): Map<Int, Double> {
val result = mutableMapOf<Int, Double>()
result[1] = 9.99
return result
}
Using framework is Swift:
let example = example()
The app will crash and display the trace as following
2019-10-30 15:37:19.096474+0800 Test[73756:3057881] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -getValue: only defined for abstract class. Define -[KotlinInt getValue:]!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23baa1ee __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50864b20 objc_exception_throw + 48
2 Foundation 0x00007fff2584a6b3 _NSRequestConcreteObject + 0
3 Foundation 0x00007fff256bea7e -[NSNumber copyWithZone:] + 129
4 CoreFoundation 0x00007fff23add550 __NSSingleEntryDictionaryI_new + 128
5 CoreFoundation 0x00007fff23ba56f3 -[NSDictionary initWithDictionary:copyItems:] + 403
6 CoreFoundation 0x00007fff23c07fc7 -[__NSPlaceholderDictionary initWithDictionary:copyItems:] + 135
7 libswiftFoundation.dylib 0x00007fff511ef3a0 $sSD10FoundationE26_forceBridgeFromObjectiveC_6resultySo12NSDictionaryC_SDyxq_GSgztFZ + 192
8 libswiftFoundation.dylib 0x00007fff511e3593 $sSD10FoundationE36_unconditionallyBridgeFromObjectiveCySDyxq_GSo12NSDictionaryCSgFZ + 67
9 Test 0x0000000102f54320 $s4Test11ContentViewV3calSSyF + 1104
10 Test 0x0000000102f53e3b $s4Test11ContentViewV4bodyQrvg + 91
11 Test 0x0000000102f549c1 $s4Test11ContentViewV7SwiftUI0C0AadEP4body4BodyQzvgTW + 17
12 SwiftUI 0x00007fff2bfb1c49 $s7SwiftUI8ViewBody33_9F92ACD17B554E8AB7D29ABB1E796415LLV5applyy0D0QzxF + 585
13 SwiftUI 0x00007fff2bfb2df9 $s7SwiftUI8ViewBody33_9F92ACD17B554E8AB7D29ABB1E796415LLVyxG14AttributeGraph07UntypedM0AafGP7_update_5graph9attributeySv_So10AGGraphRefaSo11AGAttributeatFZTW + 137
14 AttributeGraph 0x00007fff2f8f1849 $sTA + 25
15 AttributeGraph 0x00007fff2f8d9255 _ZN2AG5Graph11UpdateStack6updateEv + 1111
16 AttributeGraph 0x00007fff2f8d9513 _ZN2AG5Graph16update_attributeEjb + 377
17 AttributeGraph 0x00007fff2f8de131 _ZN2AG8Subgraph6updateEj + 929
18 SwiftUI 0x00007fff2c10d100 $s7SwiftUI9ViewGraphC14runTransaction33_D63C4EB7F2B205694B6515509E76E98BLL2inySo10AGGraphRefa_tF + 224
19 SwiftUI 0x00007fff2c10d517 $s7SwiftUI9ViewGraphC13updateOutputs2atyAA4TimeV_tFSb5prefs_Sb9idealSizeAC0F0V7outputstSo10AGGraphRefaXEfU_ + 103
20 SwiftUI 0x00007fff2c10d1d1 $s7SwiftUI9ViewGraphC13updateOutputs2atyAA4TimeV_tF + 145
21 SwiftUI 0x00007fff2c4af579 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_yyXEfU_ + 1001
22 SwiftUI 0x00007fff2c4aef8a $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtFyyXEfU_ + 634
23 SwiftUI 0x00007fff2c4a4274 $s7SwiftUI16ViewRendererHostPAAE6render8interval17updateDisplayListySd_SbtF + 436
24 SwiftUI 0x00007fff2c65a182 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 226
25 SwiftUI 0x00007fff2c65a1a5 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 21
26 UIKitCore 0x00007fff47a52ad5 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
27 QuartzCore 0x00007fff2b06e91d -[CALayer layoutSublayers] + 255
28 QuartzCore 0x00007fff2b073323 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 517
29 QuartzCore 0x00007fff2b07fa7c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
30 QuartzCore 0x00007fff2afc6e54 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
31 QuartzCore 0x00007fff2affc32f _ZN2CA11Transaction6commitEv + 643
32 UIKitCore 0x00007fff475906cd __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
33 CoreFoundation 0x00007fff23b0d09c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
34 CoreFoundation 0x00007fff23b0c808 __CFRunLoopDoBlocks + 312
35 CoreFoundation 0x00007fff23b07694 __CFRunLoopRun + 1284
36 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438
37 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65
38 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621
39 Test 0x0000000102f526fb main + 75
40 libdyld.dylib 0x00007fff516ecd29 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Actually, I want to implement the function to return the Map, but I inspect the type of example() in the Xocde's IDE is [KotlinInt : KotlinDouble]. I don't know how to fix this to use this function in the Xcode normally without the exception.
I thought there is no structure type "Map" in Kotlin corresponding to "Dictionary" in iOS Swift. Try to replace the Map with MutableMap and solve this issue.
fun example(): MutableMap <Int, Double> {
val result = mutableMapOf<Int, Double>()
result[1] = 9.99
return result
}
However, you can also cast the type in Swift for another using. For example,
let example = example() as! [Int64 : Double]
Map exist in kotlin, here an example:
val map = mutableMapOf(1 to 1.2, 2 to 1.2, 3 to 1.5)
println(map)
map[4] = 3.4
println(map)
output:
{1=1.2, 2=1.2, 3=1.5}
{1=1.2, 2=1.2, 3=1.5, 4=3.4}
I have some swift code which crashing while manipulating Data() gathered from a tcp socket. The code runs successfully when getting data from a "mostly quiet" server, but against a busier server it crashes every time.
Here's the code with some manual debugPrints. The line where I crash is "data.append(incomingData)" between "two" and "three". An earlier version was crashing while executing "data = leftOverData + incomingData".
(class property)
var leftOverData: Data?
func analyze(incomingData: Data) {
debugPrint("about to copy data")
let size = incomingData.count + (leftOverData?.count ?? 0) + 10
debugPrint("incoming data size \(incomingData.count) leftOverData.size \(String(describing: leftOverData?.count))")
var data = Data(capacity: size)
debugPrint("one")
if leftOverData != nil {
data = leftOverData!
debugPrint("two")
data.append(incomingData)
debugPrint("three")
self.leftOverData = nil
} else {
debugPrint("four")
data = incomingData
}
In the round where I crash I have 32 bytes of leftOverData plus 1448 bytes of new incoming data. Here's the manual prints up to the crash:
"about to copy data"
"incoming data size 1448 leftOverData.size Optional(32)"
"one"
"two"
2019-03-05 22:28:35.487708-0800 Netrek[99969:6764765] [General] An uncaught exception was raised
START EDIT (MORE DATA):
Added this code to print out Data internals just prior to crash:
debugPrint("data startIndex \(data.startIndex) endIndex \(data.endIndex)\n")
debugPrint("incomingData startIndex \(incomingData.startIndex) endIndex \(incomingData.endIndex)\n")
debugPrint("size \(size)")
data.append(incomingData)
Got this additional data:
"data startIndex 14472 endIndex 14480\n"
"incomingData startIndex 0 endIndex 2896\n"
"size 2914"
2019-03-06 11:53:17.906992-0800 Netrek[24085:7434170] [General] An uncaught exception was raised
2019-03-06 11:53:17.907021-0800 Netrek[24085:7434170] [General] *** -[NSConcreteMutableData subdataWithRange:]: range {14472, 8} exceeds data length 13112
Here's the code where the data originates(Network framework). This seems to crash on the third round through the receive closure.
connection.receive(minimumIncompleteLength: 1, maximumLength: 32768) { (content, context, isComplete, error) in
if let content = content {
debugPrint("content startIndex \(content.startIndex) endIndex \(content.endIndex)" )
self.delegate.gotData(data: content, from: self.hostname, port: self.port)
}
}
Here's the index info from that receive closure:
"content startIndex 0 endIndex 1448"
I wish I knew where that data length 13112 was coming from.
END EDIT
Xcode version 10.1 (10B61). Swift 4.2.
Here's all the data I can gather on the crash:
Key message from below: [NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624'
Full stack trace:
2019-03-05 22:28:35.487708-0800 Netrek[99969:6764765] [General] An uncaught exception was raised
2019-03-05 22:28:35.487742-0800 Netrek[99969:6764765] [General] *** -[NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624
2019-03-05 22:28:35.487847-0800 Netrek[99969:6764765] [General] (
0 CoreFoundation 0x00007fff31cf5f15 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff5de61efb objc_exception_throw + 48
2 CoreFoundation 0x00007fff31cf5d47 +[NSException raise:format:] + 193
3 Foundation 0x00007fff340870d9 -[NSData(NSData) subdataWithRange:] + 252
4 libswiftFoundation.dylib 0x0000000100df2c76 $S10Foundation12_DataStorageC11mutableCopyyACSnySiGFTf4xn_n + 374
5 libswiftFoundation.dylib 0x0000000100e121f9 $S10Foundation4DataV7_appendyySRyxGlFs5UInt8V_Tg5Tf4xn_n + 105
6 libswiftFoundation.dylib 0x0000000100e12340 $S10Foundation4DataV6appendyyACFySRys5UInt8VG_SiSbztXEfU_TA + 16
7 libswiftFoundation.dylib 0x0000000100d2e7d1 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_ + 113
8 libswiftFoundation.dylib 0x0000000100e0e7c1 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_TA + 33
9 libswiftFoundation.dylib 0x0000000100e59249 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_TA.75 + 9
10 libswiftFoundation.dylib 0x0000000100e0e701 $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIgyyy_SVAbFIegyyy_TRTA + 17
11 libswiftFoundation.dylib 0x0000000100e5c2b9 $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIgyyy_SVAbFIegyyy_TRTA.79 + 9
12 libswiftFoundation.dylib 0x0000000100d2bf0d $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIegyyy_SVAbFIyByyy_TR + 29
13 Foundation 0x00007fff3402734f __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke + 37
14 Foundation 0x00007fff34027324 -[_NSDispatchData enumerateByteRangesUsingBlock:] + 62
15 libswiftFoundation.dylib 0x0000000100d33d15 $S10Foundation4DataV6appendyyACF + 469
16 Netrek 0x0000000100005c63 $S6Netrek14PacketAnalyzerC7analyze12incomingDatay10Foundation0F0V_tF + 2483
17 Netrek 0x0000000100041614 $S6Netrek11AppDelegateC7gotData4data4from4porty10Foundation0E0V_SSSitF + 740
18 Netrek 0x00000001000416f0 $S6Netrek11AppDelegateCAA07NetworkC0A2aDP7gotData4data4from4porty10Foundation0F0V_SSSitFTW + 16
19 Netrek 0x00000001000352da $S6Netrek9TcpReaderC7receiveyyFy10Foundation4DataVSg_7Network12NWConnectionC14ContentContextCSgSbAI7NWErrorOSgtcfU_ + 2106
20 Netrek 0x0000000100035af7 $S6Netrek9TcpReaderC7receiveyyFy10Foundation4DataVSg_7Network12NWConnectionC14ContentContextCSgSbAI7NWErrorOSgtcfU_TA + 71
21 libswiftNetwork.dylib 0x00000001010787a0 $S7Network12NWConnectionC14receiveMessage10completionyy10Foundation4DataVSg_AC14ContentContextCSgSbAA7NWErrorOSgtc_tFySo16OS_dispatch_dataCSg_So0K19_nw_content_context_pSgSbSo0k1_N6_error_pSgtcfU_TA + 304
22 libswiftNetwork.dylib 0x0000000101083c49 $S7Network12NWConnectionC7receive23minimumIncompleteLength07maximumF010completionySi_Siy10Foundation4DataVSg_AC14ContentContextCSgSbAA7NWErrorOSgtctFySo16OS_dispatch_dataCSg_So0N19_nw_content_context_pSgSbSo0n1_Q6_error_pSgtcfU_TA + 9
23 libswiftNetwork.dylib 0x0000000101068ba8 $SSo16OS_dispatch_dataCSgSo0A19_nw_content_context_pSgSbSo0a1_D6_error_pSgIegggyg_AcESbAGIeyByyyy_TR + 88
24 libdispatch.dylib 0x00000001012169eb _dispatch_block_async_invoke2 + 83
25 libdispatch.dylib 0x00000001012077c3 _dispatch_client_callout + 8
26 libdispatch.dylib 0x000000010120abcd _dispatch_continuation_pop + 576
27 libdispatch.dylib 0x0000000101209ca3 _dispatch_async_redirect_invoke + 780
28 libdispatch.dylib 0x000000010121a270 _dispatch_root_queue_drain + 334
29 libdispatch.dylib 0x000000010121ad33 _dispatch_worker_thread2 + 125
30 libsystem_pthread.dylib 0x0000000101282119 _pthread_wqthread + 619
31 libsystem_pthread.dylib 0x0000000101281e41 start_wqthread + 13
)
2019-03-05 22:28:35.493083-0800 Netrek[99969:6764765] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624'
Any ideas what I'm doing wrong?
END EDIT
Xcode version 10.1 (10B61). Swift 4.2.
Here's all the data I can gather on the crash:
Key message from below: [NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624'
Full stack trace:
2019-03-05 22:28:35.487708-0800 Netrek[99969:6764765] [General] An uncaught exception was raised
2019-03-05 22:28:35.487742-0800 Netrek[99969:6764765] [General] *** -[NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624
2019-03-05 22:28:35.487847-0800 Netrek[99969:6764765] [General] (
0 CoreFoundation 0x00007fff31cf5f15 __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff5de61efb objc_exception_throw + 48
2 CoreFoundation 0x00007fff31cf5d47 +[NSException raise:format:] + 193
3 Foundation 0x00007fff340870d9 -[NSData(NSData) subdataWithRange:] + 252
4 libswiftFoundation.dylib 0x0000000100df2c76 $S10Foundation12_DataStorageC11mutableCopyyACSnySiGFTf4xn_n + 374
5 libswiftFoundation.dylib 0x0000000100e121f9 $S10Foundation4DataV7_appendyySRyxGlFs5UInt8V_Tg5Tf4xn_n + 105
6 libswiftFoundation.dylib 0x0000000100e12340 $S10Foundation4DataV6appendyyACFySRys5UInt8VG_SiSbztXEfU_TA + 16
7 libswiftFoundation.dylib 0x0000000100d2e7d1 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_ + 113
8 libswiftFoundation.dylib 0x0000000100e0e7c1 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_TA + 33
9 libswiftFoundation.dylib 0x0000000100e59249 $S10Foundation12_DataStorageC14enumerateBytes2in_ySnySiG_ySRys5UInt8VG_SiSbztXEtFySV_So8_NSRangeVSpy10ObjectiveC8ObjCBoolVGtXEfU_TA.75 + 9
10 libswiftFoundation.dylib 0x0000000100e0e701 $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIgyyy_SVAbFIegyyy_TRTA + 17
11 libswiftFoundation.dylib 0x0000000100e5c2b9 $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIgyyy_SVAbFIegyyy_TRTA.79 + 9
12 libswiftFoundation.dylib 0x0000000100d2bf0d $SSVSo8_NSRangeVSpy10ObjectiveC8ObjCBoolVGIegyyy_SVAbFIyByyy_TR + 29
13 Foundation 0x00007fff3402734f __49-[_NSDispatchData enumerateByteRangesUsingBlock:]_block_invoke + 37
14 Foundation 0x00007fff34027324 -[_NSDispatchData enumerateByteRangesUsingBlock:] + 62
15 libswiftFoundation.dylib 0x0000000100d33d15 $S10Foundation4DataV6appendyyACF + 469
16 Netrek 0x0000000100005c63 $S6Netrek14PacketAnalyzerC7analyze12incomingDatay10Foundation0F0V_tF + 2483
17 Netrek 0x0000000100041614 $S6Netrek11AppDelegateC7gotData4data4from4porty10Foundation0E0V_SSSitF + 740
18 Netrek 0x00000001000416f0 $S6Netrek11AppDelegateCAA07NetworkC0A2aDP7gotData4data4from4porty10Foundation0F0V_SSSitFTW + 16
19 Netrek 0x00000001000352da $S6Netrek9TcpReaderC7receiveyyFy10Foundation4DataVSg_7Network12NWConnectionC14ContentContextCSgSbAI7NWErrorOSgtcfU_ + 2106
20 Netrek 0x0000000100035af7 $S6Netrek9TcpReaderC7receiveyyFy10Foundation4DataVSg_7Network12NWConnectionC14ContentContextCSgSbAI7NWErrorOSgtcfU_TA + 71
21 libswiftNetwork.dylib 0x00000001010787a0 $S7Network12NWConnectionC14receiveMessage10completionyy10Foundation4DataVSg_AC14ContentContextCSgSbAA7NWErrorOSgtc_tFySo16OS_dispatch_dataCSg_So0K19_nw_content_context_pSgSbSo0k1_N6_error_pSgtcfU_TA + 304
22 libswiftNetwork.dylib 0x0000000101083c49 $S7Network12NWConnectionC7receive23minimumIncompleteLength07maximumF010completionySi_Siy10Foundation4DataVSg_AC14ContentContextCSgSbAA7NWErrorOSgtctFySo16OS_dispatch_dataCSg_So0N19_nw_content_context_pSgSbSo0n1_Q6_error_pSgtcfU_TA + 9
23 libswiftNetwork.dylib 0x0000000101068ba8 $SSo16OS_dispatch_dataCSgSo0A19_nw_content_context_pSgSbSo0a1_D6_error_pSgIegggyg_AcESbAGIeyByyyy_TR + 88
24 libdispatch.dylib 0x00000001012169eb _dispatch_block_async_invoke2 + 83
25 libdispatch.dylib 0x00000001012077c3 _dispatch_client_callout + 8
26 libdispatch.dylib 0x000000010120abcd _dispatch_continuation_pop + 576
27 libdispatch.dylib 0x0000000101209ca3 _dispatch_async_redirect_invoke + 780
28 libdispatch.dylib 0x000000010121a270 _dispatch_root_queue_drain + 334
29 libdispatch.dylib 0x000000010121ad33 _dispatch_worker_thread2 + 125
30 libsystem_pthread.dylib 0x0000000101282119 _pthread_wqthread + 619
31 libsystem_pthread.dylib 0x0000000101281e41 start_wqthread + 13
)
2019-03-05 22:28:35.493083-0800 Netrek[99969:6764765] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSConcreteMutableData subdataWithRange:]: range {14448, 32} exceeds data length 11624'
Any ideas what I'm doing wrong?
I am not sure why you need to initialize data variable with capacity. You can simply define var type and append the data later on.
I tried the following and it worked fine.
var leftOverData: Data?
// In viewDidLoad
leftOverData = "Hi my name is Ankit. ".data(using: .utf8)
self.analyze(incomingData: "What is your name in the context of lorem ipsum dolar sit ahem. This is an dummy text I am using to create Data.".data(using: .utf8)!)
// Updated the function as
func analyze(incomingData: Data) {
var data = Data()
if let existingData = self.leftOverData {
data = existingData
data.append(incomingData)
self.leftOverData = nil
} else {
data = incomingData
}
}
I am facing an issue from yesterday after updating system to latest macOS 10.13 beta with unity monoDevelop below is what i am getting as crash report.
Process: mono-sgen [9057]
Path: /tmp/*/mono
Identifier: com.unity.monodevelop
Version: 5.9.6 (5.9.6)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: mono-sgen [9057]
User ID: 501
Date/Time: 2017-06-15 11:43:09.345 +0530
OS Version: Mac OS X 10.13 (17A264c)
Report Version: 12
Anonymous UUID: ACA523AB-96B9-4E46-8D2A-A2210B9A181A
Sleep/Wake UUID: 5715E1CB-BBDF-4E3C-9CEE-8F8C01ADD64D
Time Awake Since Boot: 36000 seconds
Time Since Wake: 6400 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000d9d1efbd
Exception Note: EXC_CORPSE_NOTIFY
VM Regions Near 0xd9d1efbd:
Stack 00000000bf7ee000-00000000bffe5000 [ 8156K] rw-/rwx SM=COW
-->
Submap 00000000ffff0000-00000000ffff1000 [ 4K] r--/r-- SM=PRV process-only VM submap
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0xa7617f6a __pthread_kill + 10
1 libsystem_pthread.dylib 0xa77346dd pthread_kill + 307
2 libsystem_c.dylib 0xa756881e abort + 133
3 mono 0x000dc435 mono_handle_native_sigsegv + 757
4 mono 0x001282a2 mono_arch_handle_altstack_exception + 162
5 mono 0x0002890e mono_sigsegv_signal_handler + 446
6 libsystem_platform.dylib 0xa7728fcb _sigtramp + 43
7 ??? 0xffffffff 0 + 4294967295
8 mono 0x00028750 mono_sigill_signal_handler + 48
9 com.apple.Foundation 0x9524f536 _NSAddExceptionHandlerForLock + 21
10 com.apple.AppKit 0x9157d276 _NSAppKitLock + 78
11 com.apple.AppKit 0x913c4ecd -[NSApplication _addWindow:] + 50
12 com.apple.AppKit 0x913c47d0 -[NSWindow _commonInitFrame:styleMask:backing:defer:] + 295
13 com.apple.AppKit 0x913c33e9 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 940
14 com.apple.AppKit 0x9142ccaf -[NSPanel _initContent:styleMask:backing:defer:contentView:] + 67
15 com.apple.AppKit 0x913c3033 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 72
16 com.apple.AppKit 0x9142cc5a -[NSPanel initWithContentRect:styleMask:backing:defer:] + 93
17 com.apple.AppKit 0x9142c426 -[NSWindowTemplate nibInstantiate] + 419
18 com.apple.AppKit 0x91386ee5 -[NSIBObjectData instantiateObject:] + 255
19 com.apple.AppKit 0x913866f8 -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 311
20 com.apple.AppKit 0x913865bc -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 37
21 com.apple.AppKit 0x9137e6b1 loadNib + 482
22 com.apple.AppKit 0x9137dbbc +[NSBundle(NSNibLoading) _loadNibFile:nameTable:options:withZone:ownerBundle:] + 289
23 com.apple.AppKit 0x91598719 +[NSBundle(NSNibLoadingInternal) _loadNibFile:externalNameTable:options:withZone:] + 129
24 com.apple.AppKit 0x9163b5fe +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 43
25 com.apple.AppKit 0x9163b5ac _NXLoadNib + 169
26 com.apple.AppKit 0x9163b09a -[NSAlert init] + 97
27 ??? 0x085cc138 0 + 140296504
28 ??? 0x0b13c470 0 + 185844848
29 ??? 0x0b13aa70 0 + 185838192
30 ??? 0x0b13a800 0 + 185837568
31 ??? 0x0b13a738 0 + 185837368
32 ??? 0x0b139f5c 0 + 185835356
33 ??? 0x0b13a065 0 + 185835621
34 mono 0x0002b3ff mono_jit_runtime_invoke + 751
35 mono 0x001ee13f mono_runtime_invoke + 127
36 mono 0x001f4fcd mono_runtime_invoke_array + 941
37 mono 0x001679d5 ves_icall_InternalExecute + 309
38 ??? 0x0a37f690 0 + 171439760
39 mscorlib.dll.dylib 0x019ac5b9 System_Runtime_Remoting_RemotingServices_InternalExecuteMessage_System_MarshalByRefObject_System_Runtime_Remoting_Messaging_IMethodCallMessage + 521
40 mscorlib.dll.dylib 0x01999865 System_Runtime_Remoting_Messaging_StackBuilderSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 245
41 mscorlib.dll.dylib 0x01999424 System_Runtime_Remoting_Messaging_ServerObjectTerminatorSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 132
42 mscorlib.dll.dylib 0x01989230 System_Runtime_Remoting_Lifetime_LeaseSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 64
43 ??? 0x0b139e9a 0 + 185835162
44 ??? 0x0b139e2c 0 + 185835052
45 ??? 0x0b139cf0 0 + 185834736
46 mscorlib.dll.dylib 0x019b083a System_Runtime_Remoting_ClientActivatedIdentity_SyncObjectProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 154
47 mscorlib.dll.dylib 0x01999287 System_Runtime_Remoting_Messaging_ServerContextTerminatorSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 423
48 mscorlib.dll.dylib 0x0198615f System_Runtime_Remoting_Contexts_CrossContextChannel_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 239
49 mscorlib.dll.dylib 0x0198d577 System_Runtime_Remoting_Messaging_ClientContextTerminatorSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 503
50 mscorlib.dll.dylib 0x0198eeb7 System_Runtime_Remoting_Messaging_EnvoyTerminatorSink_SyncProcessMessage_System_Runtime_Remoting_Messaging_IMessage + 55
51 mscorlib.dll.dylib 0x019a377a System_Runtime_Remoting_Proxies_RemotingProxy_Invoke_System_Runtime_Remoting_Messaging_IMessage + 970
52 mscorlib.dll.dylib 0x019a2164 System_Runtime_Remoting_Proxies_RealProxy_PrivateInvoke_System_Runtime_Remoting_Proxies_RealProxy_System_Runtime_Remoting_Messaging_IMessage_System_Exception__object___ + 1268
53 ??? 0x0a37f09f 0 + 171438239
54 mono 0x0002b3ff mono_jit_runtime_invoke + 751
55 mono 0x001ee13f mono_runtime_invoke + 127
56 mono 0x001f78a1 mono_remoting_invoke + 145
57 mono 0x001bc690 mono_remoting_wrapper + 192
58 ??? 0x0a37efd8 0 + 171438040
59 ??? 0x0b1396f0 0 + 185833200
60 ??? 0x0b139608 0 + 185832968
61 ??? 0x0b139248 0 + 185832008
62 ??? 0x0b13913c 0 + 185831740
63 ??? 0x0b1390e0 0 + 185831648
64 ??? 0x0b13802c 0 + 185827372
65 ??? 0x0333c154 0 + 53723476
66 ??? 0x005800a8 0 + 5767336
67 ??? 0x0057fe2c 0 + 5766700
68 ??? 0x0057ff07 0 + 5766919
69 mono 0x0002b3ff mono_jit_runtime_invoke + 751
70 mono 0x001ee13f mono_runtime_invoke + 127
71 mono 0x001f41c1 mono_runtime_exec_main + 401
72 mono 0x001f3f64 mono_runtime_run_main + 660
73 mono 0x000a5e5d mono_jit_exec + 93
74 mono 0x000a8130 mono_main + 7904
75 mono 0x0001d730 main + 768
76 mono 0x0001d425 start + 53
Thread 1:
0 libsystem_kernel.dylib 0xa760eeaa semaphore_wait_trap + 10
1 mono 0x0027116a mono_sem_wait + 26
2 mono 0x001ec05a finalizer_thread + 154
3 mono 0x001ca065 start_wrapper + 517
4 mono 0x002766b0 inner_start_thread + 240
5 libsystem_pthread.dylib 0xa773174d _pthread_body + 292
6 libsystem_pthread.dylib 0xa7731629 _pthread_start + 376
7 libsystem_pthread.dylib 0xa7730d02 thread_start + 34
Thread 2:
0 libsystem_kernel.dylib 0xa761878e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0xa7731103 _pthread_wqthread + 1023
2 libsystem_pthread.dylib 0xa7730cde start_wqthread + 34
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 2
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 89884
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=344.8M resident=0K(0%) swapped_out_or_unallocated=344.8M(100%)
Writable regions: Total=102.0M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=102.0M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Activity Tracing 256K 2
CG image 1032K 3
CoreAnimation 32K 6
CoreUI image file 168K 3
Foundation 4K 2
Image IO 1036K 4
Kernel Alloc Once 8K 2
MALLOC 55.9M 33
MALLOC guard page 48K 12
Stack 14.0M 17
Stack Guard 56.2M 17
VM_ALLOCATE 29.6M 56
VM_ALLOCATE (reserved) 164K 6 reserved VM address space (unallocated)
__DATA 13.7M 319
__FONT_DATA 4K 2
__LINKEDIT 88.2M 45
__OBJC 6616K 136
__TEXT 256.6M 318
__UNICODE 556K 2
mapped file 265.7M 259
shared memory 644K 12
=========== ======= =======
TOTAL 790.1M 1235
TOTAL, minus reserved VM space 790.0M 1235
Model: MacBookPro9,2, BootROM MBP91.00D3.B21, 2 processors, Intel Core i5, 2.5 GHz, 12 GB, SMC 2.2f44
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x0198, 0x393930353432382D3432372E4130304C4620
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x0198, 0x393930353436392D3036332E4130304C4620
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xF5), Broadcom BCM43xx 1.0 (7.21.190.7.1a3)
Bluetooth: Version 6.0.0d40, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: APPLE HDD HTS545050A7E362, 500.11 GB
Serial ATA Device: HL-DT-ST DVDRW GS41N
USB Device: USB 2.0 Bus
USB Device: Hub
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: IR Receiver
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: USB 2.0 Bus
USB Device: Hub
USB Device: FaceTime HD Camera (Built-in)
USB Device: USB 3.0 Bus
USB Device: vivo Android Phone
Thunderbolt Bus: MacBook Pro, Apple Inc., 25.1
I have already tried with permission on monoDevelop.app contents folder and applied to all sub folders as well.
I got this issue as well. Try removing your MonoDevelop data (this way works for me).
Open Terminal and run this:
rm -rf ~/Library/Preferences/MonoDevelop-Unity-5.0
Update (Feb 2018):
As of 2018, Unity Technologies has been recommending Visual Studio for Mac as the preferred editor for Mac users. Before all those red flags and alarms tell you to flee out the door, please be advised that VS/Mac is a fork of Xamarin Studio (acquired by Microsoft), which in turn is a fork of MonoDevelop.
As it is a fork, VS/Mac is just an update of MonoDevelop, is more actively maintained, and has fewer crashes, memory leaks, and other productivity sinks. In my use for the past month, VS/Mac has been very stable, its memory footprint is quite stable as well, and there is no noticeable bloat as far as I can tell.
Finally, VS/Mac is available in three versions: Community, Professional, and Enterprise.
You can download VS/Mac from http://visualstudio.com
The download and installation is just as simple as installing MonoDevelop or Xamarin.
Just go into Unity preferences, and choose VS/Mac as your external code editor, and you're good to go.
Give it a try.
Unity has issued patches to address the MonoDevelop crashes. The patches exist for the following versions of Unity:
2017.2
2017.1
5.6.3
5.5.4
If you're using a version that is not listed, you may have to change Unity versions, roll back Mac OS X, or use the Xamarin workaround.
Here's the URL to Unity patches:
https://unity3d.com/unity/qa/patch-releases
Here's the Unity Forum link for more info:
https://forum.unity.com/threads/unity-and-macos-10-13-high-sierra.474527/
I've put a bounty on this, knowing full well there's some workarounds. I just prefer using the default integrated MonoDevelop and am hoping this can be solved. Unity is already aware of the issue with MonoDevelop + High Sierra, but no solutions have been offered.
For those looking for a workaround, you download MonoDevelop + Xamarin Studio straight from here, which works without crashing for me.
If you're using multiple monitors one cause for MonoDevelop crashing is having the IDE open in a secondary monitor during previous session.
In this case you don't need to remove all your preferences but instead edit MonoDevelopProperties.xml and remove the "bounds" property within the WorkbenchMemento node:
<Property key="bounds" value="-37, 162, 1920, 1020" />
If you're using two or more monitors, try moving Unity IDE to another monitor and then launch MonoDevelop.
For some reason, if you closed MonoDevelop main window on a different monitor and try to start it again on another monitor, it crashes.
Since Xcode 7 and Swift 2.0, in my current project, I get the error above :
Assertion failed: (Conformance.size() == Archetype->getConformsTo().size() && "substitution conformances don't match archetype"), function Substitution, file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-700.0.38.1/src/swift/lib/AST/Substitution.cpp, line 64.
0 swift 0x0000000111d84e0b llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x0000000111d8554b SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff8bcc7f1a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1949532416
4 libsystem_c.dylib 0x00007fff89e58b53 abort + 129
5 libsystem_c.dylib 0x00007fff89e20c39 basename + 0
6 swift 0x0000000110557c9f swift::Substitution::Substitution(swift::ArchetypeType*, swift::Type, llvm::ArrayRef<swift::ProtocolConformance*>) + 271
7 swift 0x0000000110269fa0 swift::SILCloner<swift::SILInliner>::getOpConformances(swift::ArchetypeType*, swift::CanType, llvm::ArrayRef<swift::ProtocolConformance*>) + 256
8 swift 0x0000000110263235 swift::SILCloner<swift::SILInliner>::visitInitExistentialRefInst(swift::InitExistentialRefInst*) + 133
9 swift 0x000000011025831b swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 75
10 swift 0x00000001102574e1 swift::SILInliner::inlineFunction(swift::FullApplySite, llvm::ArrayRef<swift::SILValue>) + 897
11 swift 0x00000001100c92d3 (anonymous namespace)::SILPerformanceInlinerPass::run() + 9427
12 swift 0x000000011007d9a8 swift::SILPassManager::runOneIteration() + 2072
13 swift 0x000000011007a4c8 swift::runSILOptimizationPasses(swift::SILModule&) + 424
14 swift 0x000000010fd9e83f performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 9583
15 swift 0x000000010fd9c0b3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2515
16 swift 0x000000010fd9828f main + 1983
17 libdyld.dylib 0x00007fff87ca05c9 start + 1
Stack dump:
If I set the Optimisation Level to "None", it works, but with optimisation ( by default), it shows me this.