Xcode 8 (Swift 3) Command failed due to signal: Killed: 9

前端 未结 5 1631
一向
一向 2021-01-02 00:52

After upgrading to Xcode 8 and converting all my code to Swift 3, I have troubles compiling swift resources. It takes a very long time, and my computer gets super laggy and

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 01:03

    Believe it or not, this is the piece of code that was causing the problem for me. With it in, the compile takes about 30 minutes. If I simply comment out that chunk of code, it compiles in less than 30 seconds.

    let params : [String: Any] = [
        "person_id"       : kPersonId,
        "person_promo_id" : promo.personPromoId!,
        "promo_page_id"   : promo.promoPageId!,
        "seq_no"          : promo.seqNo!,
        "promo_type"      : promo.promoType!,
        "page_name"       : promo.pageName!,
        "image_name"      : promo.imageName!,
        "start_date"      : promo.startDate!,
        "end_date"        : promo.endDate!,
        "website"         : promo.website!,
        "facility_name"   : promo.facilityName!,
        "address"         : promo.street!,
        "city"            : promo.city!,
        "prov_state_cd"   : promo.provState!,
        "country_cd"      : promo.country!,
        "contact_name"    : promo.contactName!,
        "contact_phone"   : promo.contactPhone!,
        "latitude"        : promo.latitude!,
        "longitude"       : promo.longitude!,
        "bgColorRed"      : promo.bgColorRed!,
        "bgColorGreen"    : promo.bgColorGreen!,
        "bgColorBlue"     : promo.bgColorBlue!,
        "promoCategories" : promoCat
    ]
    

    Based on this and other things I have read, I would hunt for a case where you're assigning values to a large or nested dictionary with an Any or AnyObject in the definition. I'm guessing that it's the Any that is sending the compiler off on a wild good chase.

    If you check your log where it fails, it should have the error right at the object that failed. This should give you a clue as to what file to look in.

    Edit: @Jay Chow, this is how I solved the compiler problem with the code above:

    var params : [String : Any] = [:]
    params["person_id"]         = kPersonId
    params["person_promo_id"]   = promo.personPromoId
    params["promo_page_id"]     = promo.promoPageId
    params["seq_no"]            = promo.seqNo
    params["promo_type"]        = promo.promoType
    params["page_name"]         = promo.pageName
    params["image_name"]        = promo.imageName
    params["start_date"]        = promo.startDate
    params["end_date"]          = promo.endDate
    params["website"]           = promo.website
    params["facility_name"]     = promo.facilityName
    params["address"]           = promo.street
    params["city"]              = promo.city
    params["prov_state_cd"]     = promo.provState
    params["country_cd"]        = promo.country
    params["contact_name"]      = promo.contactName
    params["contact_phone"]     = promo.contactPhone
    params["latitude"]          = promo.latitude
    params["longitude"]         = promo.longitude
    params["bgColorRed"]        = promo.bgColorRed
    params["bgColorGreen"]      = promo.bgColorGreen
    params["bgColorBlue"]       = promo.bgColorBlue
    params["promoCategories"]   = promoCat
    

提交回复
热议问题