Try not to catch in the xcode simulator suddenly

I have had this bit of code in my application for many years:

 for (NSString* key in keyedValues) {
        NSLog(@"%@ %@",key,[keyedValues objectForKey:key]);
        @try {
            [self setValue:[keyedValues objectForKey:key] forKey:key];
        }
        @catch (NSException *exception) { // this assumes this is a date from our JSON
            [self setValue:[dfm dateFromString:[keyedValues objectForKey:key]] forKey:key];
        }
    }

It handles the strange date format that I get from the web service, if the data is scared, an error occurs, and I format it in catch. Literally nothing has changed with this piece of code or the web service for many years.

Today, while working on other things in my simulator application, this code stops working. This means that an error occurs in an attempt, but just stops there, and nothing happens in catch.

+4
source share

Source: https://habr.com/ru/post/1583818/


All Articles