Reputation: 325
I am trying to archive my recent app . I am using xcode 7.3.1 and the code is mostly in swift. It runs on simulator , no issues in that. When I try to archive it , it stucks in compiling swift source files. I have tried solutions like restarting the xcode , mac ,cleaning it , derived data deleting. But no matter what I do , it doesn't compile.
Is there any way to debug this ?
Note : I have two xcodes installed 8.1 and 7.3.1. It used to work earlier with both installed in system.
Upvotes: 2
Views: 283
Reputation: 325
So finally I figured it out. Here is the code which was culprit -
func getReferralValueToShow() -> Double
{
var valueToReturn = self.referral % 25
if self.referral<25
{
valueToReturn = self.referral
}
else
{
valueToReturn = 25
}
if priceSubTotal() < Double(valueToReturn) {
return a
}
else
{
return Double(valueToReturn)
}
}
func priceSubTotal() -> Double {
return quantities.reduce(0, combine: { (t, q) in t + q.totalPrice })
}
Here is code that worked
func getReferralValueToShow() -> Double
{
var valueToReturn = self.referral % 25
if self.referral<25
{
valueToReturn = self.referral
}
else
{
valueToReturn = 25
}
let a = priceSubTotal()
if a < Double(valueToReturn) {
return a
}
else
{
return Double(valueToReturn)
}
}
func priceSubTotal() -> Double {
return quantities.reduce(0, combine: { (t, q) in t + q.totalPrice })
}
The problem was to call priceSubTotal in if statement , I hope it helps anyone.
Upvotes: 0