UIDevice Name unexplainably won't compare

122 views Asked by At

This app runs on two phones (Master/Slave). I was distinguishing the phones by screen size but we had to replace one (same size).

So I decide to make the distinction using UIDevice.current.name instead. This is in ViewDidLoad

print(UIDevice.current.name)

if UIDevice.current.name == "Slave" {isSlavePhone = true;print("SLAVE PHONE")}

else if UIDevice.current.name == "Master" {print("MASTER PHONE")}

else {print("error")}

which gives this output

Slave

error

So it gets UIDevice.current.name showing as "Slave". I verified there's no space at end with .count. But when the If/Else runs it doesn't match.

I'm confused and would like to know why. Also curious any other ways to distinguish devices that might work for now.

0

There are 0 answers