I noticed that the cancel button is only not visible when it's state is "normal" so I found this code which solve the problem but I don't think this is the intended approach.
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor greenColor]} forState:UIControlStateNormal];