"而崩溃-6ren"> "而崩溃-Crashlytics 报告了多次崩溃并显示以下消息: function signature specialization 这个异常首先意味着什么? 这是我的代码,在闭包内的“return resu-6ren">
gpt4 book ai didi

iOS 应用程序因 "function signature specialization "而崩溃

转载 作者:行者123 更新时间:2023-11-29 01:41:02 29 4
gpt4 key购买 nike

Crashlytics 报告了多次崩溃并显示以下消息:

function signature specialization <Arg[0] = Exploded, Arg[2] = Exploded>

这个异常首先意味着什么?

这是我的代码,在闭包内的“return resultSoFar”中报告了崩溃。

private class func reduceMemberships(memberships: [HappeningMember]) -> (map: Dictionary<String, HappeningMember>, maxDateAsString: String?) {
let maxDateAsString = Session.lastUpdatedAt
let maxDateAsDouble = (maxDateAsString == nil) ? 0 : DateUtil.localDateFromIsoDateString(maxDateAsString!)!.timeIntervalSince1970
let initialTuple = (map: Dictionary<String, HappeningMember>(), maxDateAsString: maxDateAsString, maxDateAsDouble: maxDateAsDouble )
let reductionResult = memberships.reduce(initialTuple) {
(var resultSoFar, membership) in
let membershipUpdatedAtAsAdouble = DateUtil.localDateFromIsoDateString(membership.updatedAt)!.timeIntervalSince1970
resultSoFar.map[membership.happening._id] = membership
resultSoFar.maxDateAsDouble = max(membershipUpdatedAtAsAdouble, resultSoFar.maxDateAsDouble)
resultSoFar.maxDateAsString = (resultSoFar.maxDateAsDouble == membershipUpdatedAtAsAdouble) ? membership.updatedAt : resultSoFar.maxDateAsString
return resultSoFar // CRASHES HERE
}
return (reductionResult.map, reductionResult.maxDateAsString)
}

最佳答案

我怀疑这是因为您正在从完成处理程序返回。尝试使用完成处理程序而不是返回,这将以该函数的异步方式工作。

private class func reduceMemberships(memberships: [HappeningMember], completion: (map: Dictionary<String, HappeningMember>, maxDateAsString: String?)) {
let maxDateAsString = Session.lastUpdatedAt
let maxDateAsDouble = (maxDateAsString == nil) ? 0 : DateUtil.localDateFromIsoDateString(maxDateAsString!)!.timeIntervalSince1970
let initialTuple = (map: Dictionary<String, HappeningMember>(), maxDateAsString: maxDateAsString, maxDateAsDouble: maxDateAsDouble )
let reductionResult = memberships.reduce(initialTuple) {
(var resultSoFar, membership) in
let membershipUpdatedAtAsAdouble = DateUtil.localDateFromIsoDateString(membership.updatedAt)!.timeIntervalSince1970
resultSoFar.map[membership.happening._id] = membership
resultSoFar.maxDateAsDouble = max(membershipUpdatedAtAsAdouble, resultSoFar.maxDateAsDouble)
resultSoFar.maxDateAsString = (resultSoFar.maxDateAsDouble == membershipUpdatedAtAsAdouble) ? membership.updatedAt : resultSoFar.maxDateAsString
completion(map: resultSoFar.map, maxDateAsString: resultSoFar.maxDateAsString )
}
completion(map: reductionResult.map, maxDateAsString: reductionResult.maxDateAsString)
}

关于iOS 应用程序因 "function signature specialization <Arg[0] = Exploded, Arg[2] = Exploded>"而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32374465/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com