我正在使用Promise套件4.4,并在以下问题中运行 标记为3的然后立即返回,而无需等待解决。在 then 中赋予nil属性。4.切换位置后,调用的方法没有影响。
return firstly{ () -> Promise<PropertyDMO> in //1
if let property = property {
return Promise.init(value: property)
} else {
return fetchUserData()
}
}.then { property -> Promise<PropertyDMO> in //2
self.getSessionId(property: property)
}
.then { property -> Promise<PropertyDMO> in //3
self.updateSessionToken(property)
// what ever function is in this then block will not wait for resolver
}
.then{ property -> Promise<PropertyDMO> in //4
// will not get property obj here since the earlier then returned before resolve and printing property obj gave UnsealedState: Optional("Pending with 0 handlers")
}// catch stuff beow
promise链中发生了什么事?