diff options
author | Eddie Ehlin <eddiex@eddiex.se> | 2013-01-14 20:51:56 +0100 |
---|---|---|
committer | Eddie Ehlin <eddiex@eddiex.se> | 2013-01-14 20:51:56 +0100 |
commit | e37c2ec441803e24907427004e2f465baeba6eeb (patch) | |
tree | 9adceed1c979b396a90661750f0e756aa5258415 | |
parent | 5ea77865b929a80e9f32f7d1304cdfbdaec819d5 (diff) | |
download | iBean-e37c2ec441803e24907427004e2f465baeba6eeb.tar.gz iBean-e37c2ec441803e24907427004e2f465baeba6eeb.zip |
Added initial support for displaying error messages. Left to do is to use localizedDescription in the messages.
-rw-r--r-- | iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate | bin | 32990 -> 33266 bytes | |||
-rw-r--r-- | iBean/iBean/AddBeanViewController.m | 7 | ||||
-rw-r--r-- | iBean/iBean/AppDelegate+Storage.m | 13 | ||||
-rw-r--r-- | iBean/iBean/BeanCollectionBeanListViewController.m | 1 | ||||
-rw-r--r-- | iBean/iBean/BeanCollectionInfoViewController.m | 8 | ||||
-rw-r--r-- | iBean/iBean/BeanCollectionListViewController.m | 10 | ||||
-rw-r--r-- | iBean/iBean/ExtractionViewController.m | 6 | ||||
-rw-r--r-- | iBean/iBean/InstaBeanViewController.m | 8 |
8 files changed, 41 insertions, 12 deletions
diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 9208585..b1d7096 100644 --- a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate +++ b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/iBean/iBean/AddBeanViewController.m b/iBean/iBean/AddBeanViewController.m index 553bc93..a6dc11c 100644 --- a/iBean/iBean/AddBeanViewController.m +++ b/iBean/iBean/AddBeanViewController.m @@ -117,7 +117,12 @@ } else { -#warning TODO - Messagebox telling user that error occured. + UIAlertView *createErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Create bean error!" + message:@"Unable to create a new bean.\n(Please check available memory and try again.)" + delegate:nil + cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [createErrorAlert show]; } } diff --git a/iBean/iBean/AppDelegate+Storage.m b/iBean/iBean/AppDelegate+Storage.m index 013ce10..f678397 100644 --- a/iBean/iBean/AppDelegate+Storage.m +++ b/iBean/iBean/AppDelegate+Storage.m @@ -56,7 +56,12 @@ if (fetchRequestResult == nil || fetchRequestError != nil) { NSLog(@"getInstaBeanConfiguration - Fetch request resulted in an error!"); -#warning TODO: Implement proper error handling (perhaps a message box?) + + UIAlertView *loadErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Load error!" + message:@"Unable to load iBean configuration." + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [loadErrorAlert show]; } else if (fetchRequestResult.count == 0) { @@ -88,7 +93,11 @@ if (fetchRequestResult == nil || fetchRequestError != nil) { NSLog(@"getBeanCollections - Fetch request resulted in an error!"); -#warning TODO: Implement proper error handling (perhaps a message box?) + UIAlertView *loadErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Load error!" + message:@"Unable to load bean collections." + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [loadErrorAlert show]; } } diff --git a/iBean/iBean/BeanCollectionBeanListViewController.m b/iBean/iBean/BeanCollectionBeanListViewController.m index 61265ee..a7b39c8 100644 --- a/iBean/iBean/BeanCollectionBeanListViewController.m +++ b/iBean/iBean/BeanCollectionBeanListViewController.m @@ -194,7 +194,6 @@ [self.beanCollection replaceBeansAtIndexes:beanIndexes withBeans:beans]; } } -#warning TODO - Make sure to test to "view/edit" bean after moving it, so that it is correct item! :-) } @end diff --git a/iBean/iBean/BeanCollectionInfoViewController.m b/iBean/iBean/BeanCollectionInfoViewController.m index 68c6efb..e9c9b95 100644 --- a/iBean/iBean/BeanCollectionInfoViewController.m +++ b/iBean/iBean/BeanCollectionInfoViewController.m @@ -161,8 +161,12 @@ } - (void) cancelBeanCollection:(id)sender -{ - UIAlertView *confirmCancel = [[UIAlertView alloc] initWithTitle:@"Cancel?" message:@"Are you sure you want to cancel?\n(Data entered will be lost)" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No", nil]; +{ + UIAlertView *confirmCancel = [[UIAlertView alloc] + initWithTitle:@"Cancel?" + message:@"Are you sure you want to cancel?\n(Data entered will be lost)" + delegate:self + cancelButtonTitle:@"Yes" otherButtonTitles:@"No", nil]; [confirmCancel show]; } /***************************************************** diff --git a/iBean/iBean/BeanCollectionListViewController.m b/iBean/iBean/BeanCollectionListViewController.m index f466437..236b086 100644 --- a/iBean/iBean/BeanCollectionListViewController.m +++ b/iBean/iBean/BeanCollectionListViewController.m @@ -115,7 +115,13 @@ if ([(AppDelegate*) [[UIApplication sharedApplication] delegate] deleteObject:[self.beanCollections objectAtIndex:indexPath.row]] != nil) { NSLog(@"deleteObject returned an error when deleting bean collection!"); -#warning TODO: Handle deletion error!? + UIAlertView *deleteErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Delete error!" + message:[NSString stringWithFormat:@"Unable to delete bean collection:%@", [tableView cellForRowAtIndexPath:indexPath].textLabel.text] + delegate:nil + cancelButtonTitle:@"OK" otherButtonTitles: nil]; + [deleteErrorAlert show]; + } else { @@ -138,7 +144,7 @@ - (void) initViewController { NSLog(@"BeanCollectionListViewController - initViewController"); - +#warning TODO - Test on real hw to see if we need to have conditional reloading (i.e.: only when new data has been added!) //Allocate edit's done button self.beanCollectionsListEditDoneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleEditMode:)]; diff --git a/iBean/iBean/ExtractionViewController.m b/iBean/iBean/ExtractionViewController.m index a96b895..cbabd22 100644 --- a/iBean/iBean/ExtractionViewController.m +++ b/iBean/iBean/ExtractionViewController.m @@ -85,7 +85,11 @@ if (commitError != nil) { -#warning TODO - Display error messsag! + UIAlertView *commitErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Save error!" + message:[commitError localizedDescription] + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [commitErrorAlert show]; return NO; } diff --git a/iBean/iBean/InstaBeanViewController.m b/iBean/iBean/InstaBeanViewController.m index 4b28005..5d3d566 100644 --- a/iBean/iBean/InstaBeanViewController.m +++ b/iBean/iBean/InstaBeanViewController.m @@ -57,9 +57,7 @@ if (self.configuration == nil) { - //TODO: Display error! NSLog(@"initInstaBean received nil for configuration!"); -#warning TODO: Display error!? return; } } @@ -131,7 +129,11 @@ if (error != nil) { NSLog(@"InstaBean unable to save configuration!"); -#warning TODO: Handle this error? + UIAlertView *saveErrorAlert = [[UIAlertView alloc] + initWithTitle:@"Save error!" + message:@"Unable to save configuration." + delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; + [saveErrorAlert show]; } } |