ios - Command Failed due to signal: Segmentation Fault 11 -- Xcode 8 Swift 3 -


after intense googling , brainstorming, can't find solution let's see if stack overflow has magic solution need. using contacts framework fetch dates contact. however, works need sort dates in order work. result, extending array of cncontact, , inside extension have function work. no errors show in issue navigator when build issue in report navigator saying command failed due signal: segmentation fault 11. believe issue use of generics because report navigator pointing line, , googling suggests that issue coming have no workarounds. (i highly suspect i'm not sure.)

let me share code you: this inside extension of array of cncontacts.

typealias contactdate = cnlabeledvalue<nsdatecomponents> func filteredandsorteddates() -> [contactdate : cncontact] { // error occurs on line according issue.      var alldates: [contactdate : cncontact] = [:]      var sorteddates: [contactdate: cncontact] = [:]       contact in self {         if contact.iskeyavailable(cncontactdateskey) {             date in contact.dates {                 alldates[date] = contact             }         }     }      (key, value) in (array(alldates).sorted {         date1, date2 in         if date1.key.value.month == date2.key.value.month {             return date1.key.value.day < date2.key.value.day         } else {             return date1.key.value.month < date2.key.value.month         }     }) {         sorteddates[key] = value     }      return sorteddates } 

here screenshots of issue: error1 error2

your code causing swift compiler crash when assign empty dictionary alldates and/or sorteddates:

var alldates: [contactdate: cncontact] = [:] var sorteddates: [contactdate: cncontact] = [:] 

at first thought due cnlabeledvalue not conforming hashable don't think it's problem code. example crashes compiler:

var crashingdict: [cnlabeledvalue<nsdatecomponents>: cncontact] = [:] 

but doesn't:

 var workingdict: [cncontact: cnlabeledvalue<nsdatecomponents>] = [:] 

and in second example, cncontact key doesn't conform hashable either.

my advice swap values in dict , code working way. best file bug report apple.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -