I am trying to delete an item from my UCLCupplay. The item has been saved using the coredata. Removing the item works until I reload the view or restart the app. Both call getCards below when the item comes back, and even in the core data database it seems that the object has not been removed.
Code:
- (zero) removeCard: (int) status {UserModel * selectedUser = [get self-userfarmdi]; Cardmodel * Cardatoumov; (Cardmodel * Cardmodel in selected user code) {if (cardmodel.position.intValue == position) {cardToRemove = cardmodel; break; }} Int Place Callcard = CardTureVoice. Business Interval; [Remove the selected usercardAbbct: Cardromov]; NSMutableArray * Card = [selectedUser.cards.array mutableCopy]; NSLog (@ "cardscount:% d", cardcount); // This (cardmodel.position.intValue> StatusAoltar) changes the status of the card to remove the above cards for the card (in CardModel * CardModel card) {[cardmodel setPosition: [NSNumber numberWithInt: (cardmodel. Position. IntValue - 1)]]; [Change selected user object encodedindex: cardmodel.position.intValue withObject: cardmodel];}} NSError * error = zero; if (! [Refrain from context: & amp; error]) {nslog (@ "Deleting card failed% @", error);} NSLog (@ "saved card:% d", [manually );} - (NSMutableArray *) GetCards {UserModel * selectedUser = [Get Yourself User FROMDB]; NSMutableArray * Card = [[NSMutableArray alloc] init]; (Cardmodel * CardModel in selected User Card) {[Card addObject: [self model card: cardmodel]];} NSLog (@ "loaded card:% d", cardcount); return card;} output:
< Pre> 2015-03-17 11: 13: 56.259 Bainest [3593: 34 9] Loaded Card: 4 2015-03-17 11:13: 56.260 Beenxt [35 9 3: 34 9] Saved Cards: 4 2015-03-17 11:13: 56.271 Beanux [3593: 34 9] Load that Gone Cards: 4 // Reloading VIEW 2015-03-17 11: 14: 02.351 Beanux [3593: 349310] Loaded Card: 5
If you want to delete the card you need [reference to call the deletedObject: card model] before calling Save - You are manipulating the relationship but it is not really about removing the card.
No comments:
Post a Comment