rweichler / cylinder

123 stars 47 forks source link

Fix crash due to UIAlertView being deprecated #87

Open ryannair05 opened 3 years ago

ryannair05 commented 3 years ago

UIAlertView has been deprecated since iOS 9 but only crashes due to its deprecation on iOS 13.4 and up.

rweichler commented 3 years ago

Hey. I like this change in general, but now there's duplicated code everywhere, can you try to simplify it? I think a shared "alert" function that does the iOS version check would be cleaner. I am thinking something like this, but I am open to other ideas:

void show_alert(NSString *title, NSString *body, void(^handler)(int selectedIndex))
{
    if(ios_version <= 8) {
        // old code
    } else {
        // new code
    }
}