Sure, you can use a @try
-@catch
-@finally
block, with the @catch
omitted.
MyConnection * connection = [ConnectionPool ConnectionWithDetails: @"host/server/port/etc"];
@try {
[connection doSomething];
}
@finally {
[ConnectionPool ReleaseConnection: connection];
}
No matter how you exit the @try
block, the @finally
block will run.