Created
June 9, 2014 10:30
-
-
Save sideshowcoder/48ef31df4bad66c1b152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def database | |
return @database if @database | |
manager = CBLManager.sharedInstance | |
error_ptr = Pointer.new(:object) | |
@database = manager.databaseNamed("todos", error: error_ptr) | |
unless @database | |
error = error_ptr[0] | |
alert = UIAlertView.alloc.initWithTitle("Local Database Error", | |
message:"No access to local database. #{error}", | |
delegate:nil, | |
cancelButtonTitle:"Ok", | |
otherButtonTitles: nil) | |
alert.show | |
else | |
@database | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment