Bien sûr, vous pouvez utiliser un @try
-@catch
-@finally
bloc, avec le @catch
omis.
MyConnection * connection = [ConnectionPool ConnectionWithDetails: @"host/server/port/etc"];
@try {
[connection doSomething];
}
@finally {
[ConnectionPool ReleaseConnection: connection];
}
Peu importe comment vous quittez le @try
bloc, le @finally
Le bloc fonctionnera.