Skip to content

Commit

Permalink
Dealing with some warnings in the Recipes sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Coeur committed May 30, 2019
1 parent 366270e commit aca5a64
Show file tree
Hide file tree
Showing 17 changed files with 551 additions and 3,944 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ + (NSManagedObjectContext *) MR_contextForCurrentThread;
NSMutableDictionary *threadDict = [[NSThread currentThread] threadDictionary];
NSManagedObjectContext *threadContext = [threadDict objectForKey:kMagicalRecordManagedObjectContextKey];
NSNumber *currentCacheVersionForContext = [threadDict objectForKey:kMagicalRecordManagedObjectContextCacheVersionKey];
NSAssert((threadContext && currentCacheVersionForContext) || (!threadContext && !currentCacheVersionForContext),
NSAssert((threadContext != nil && currentCacheVersionForContext != nil)
|| (threadContext == nil && currentCacheVersionForContext == nil),
@"The Magical Record keys should either both be present or neither be present, otherwise we're in an inconsistent state!");
if ((threadContext == nil) || (currentCacheVersionForContext == nil) || ((int32_t)[currentCacheVersionForContext integerValue] != targetCacheVersionForContext))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ - (void)viewDidLoad {
}


- (void)viewDidUnload {
self.instructionsText = nil;
self.nameLabel = nil;

[super viewDidUnload];
}


- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ - (void)viewDidLoad {
// Configure the navigation bar
self.navigationItem.title = @"Add Recipe";

UIBarButtonItem *cancelButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancel)];
UIBarButtonItem *cancelButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStylePlain target:self action:@selector(cancel)];
self.navigationItem.leftBarButtonItem = cancelButtonItem;

UIBarButtonItem *saveButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStyleDone target:self action:@selector(save)];
Expand All @@ -68,13 +68,6 @@ - (void)viewDidLoad {
}


- (void)viewDidUnload {
self.nameTextField = nil;

[super viewDidUnload];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Support all orientations except upside-down
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
Expand Down
10 changes: 2 additions & 8 deletions Samples/iOS/Application/Controllers/RecipeDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,8 @@ - (void)viewWillAppear:(BOOL)animated {
}


- (void)viewDidUnload {
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
self.tableHeaderView = nil;
self.photoButton = nil;
self.nameTextField = nil;
self.overviewTextField = nil;
self.prepTimeTextField = nil;
[super viewDidUnload];
}


Expand Down Expand Up @@ -569,7 +563,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
self.recipe.thumbnailImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[self dismissModalViewControllerAnimated:YES];
[self dismissViewControllerAnimated:YES completion:nil];
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ - (void)viewDidLoad {
}

// clean up our new observers
- (void)viewDidUnload {
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];

[super viewDidUnload];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ - (void)viewDidLoad {
}


- (void)viewDidUnload {
self.tableView = nil;

[super viewDidUnload];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ - (void)viewDidLoad {
}


- (void)viewDidUnload {
self.pickerViewContainer = nil;

self.metricPickerController = nil;
self.metricPickerViewContainer = nil;

self.imperialPickerController = nil;
self.imperialPickerViewContainer = nil;

self.segmentedControl = nil;

[super viewDidUnload];
}


- (IBAction)toggleUnit {

/*
Expand Down
3 changes: 1 addition & 2 deletions Samples/iOS/Application/Delegate/MGPRecipesAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[MagicalRecord setupCoreDataStackWithStoreNamed:kRecipesStoreName];

// Override point for customization after application launch.
// self.window.backgroundColor = [UIColor whiteColor];
self.recipeListController.managedObjectContext = [NSManagedObjectContext MR_defaultContext];
[self.window addSubview:self.tabBarController.view];
[self.window setRootViewController:self.tabBarController];
[self.window makeKeyAndVisible];
return YES;
}
Expand Down
Loading

0 comments on commit aca5a64

Please sign in to comment.