IOS color detection

Hi! i’m trying to do color detection in IOS.
But the code still crashing, did someone try this before?
Some advices?
Thanks