Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:33:56+00:00 2026-05-22T15:33:56+00:00

I am trying to clean up the objects which has status uncompleted. Then I

  • 0

I am trying to clean up the objects which has status uncompleted. Then I got delete exception while delete these objects from Core Data. Could you help me to point out mistakes? Thanks

Here is the code:

- (void) cleanDownloadQueue {
NSMutableArray *cleanedAssetFiles = [[NSMutableArray alloc] init];
//get objects from context
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[self AssetFileEntityDescription]];
NSString *name = @"downloadStatus"; 
NSInteger value = COMPLETED;
NSPredicate *predicate =[NSPredicate predicateWithFormat:@"%K != %i",name,value];
[fetchRequest setPredicate:predicate];
NSArray *results = [[self.managedObjectContext executeFetchRequest:fetchRequest error:&error] mutableCopy];
//NSLog(@"current length results length: %i", [results count]);
if ([results count] > 0) {
    for (NSObject *obj in results){
        if ([obj isKindOfClass:[AssetFile class]]) {
            AssetFile *assetFile = (AssetFile *) obj;
            //assetFile.srAsset.assetFile = nil;
            [cleanedAssetFiles addObject:assetFile];

        }
    }
}

[fetchRequest release];
[results release];
for (AssetFile *afile in cleanedAssetFiles) {
    [self.managedObjectModel delete:afile];
}
if ([cleanedAssetFiles count] > 0) {
    [self saveManagedObjectChanges];
}
[cleanedAssetFiles release];

}

And here is the log:

 <Error>: -[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0
May 19 21:57:10 unknown DMC to Go[1182] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObjectModel delete:]: unrecognized selector sent to instance 0x1d8dd0'
    *** Call stack at first throw:
    (
        0   CoreFoundation                      0x32a9d64f __exceptionPreprocess + 114
        1   libobjc.A.dylib                     0x35475c5d objc_exception_throw + 24
        2   CoreFoundation                      0x32aa11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
        3   CoreFoundation                      0x32aa0649 ___forwarding___ + 508
        4   CoreFoundation                      0x32a17180 _CF_forwarding_prep_0 + 48
        5   DMC to Go                           0x0000483f -[dmcIpadAppDelegate cleanDownloadQueue] + 934
        6   DMC to Go                           0x0001b617 +[DmcIpadAppDelegate cleanDownloadQueue] + 82
        7   DMC to Go                           0x0000b35d -[SRListViewController viewDidLoad] + 40
        8   UIKit                               0x3262cf0f -[UIViewController view] + 110
        9   UIKit                               0x3263b5ef -[UIViewController contentScrollView] + 22
        10  UIKit                               0x3263b45f -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 30
        11  UIKit                               0x3263b35d -[UINavigationController _layoutViewController:] + 24
        12  UIKit                               0x3263ae35 -[UINavigationController _startTransition:fromViewController:toViewController:] + 380
        13  UIKit                               0x3263ac43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
        14  UIKit                               0x3263ab87 -[UINavigationController viewWillLayoutSubviews] + 14
        15  UIKit                               0x3263ab23 -[UILayoutContainerView layoutSubviews] + 138
        16  UIKit                               0x325fb5fb -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 26
        17  CoreFoundation                      0x32a0af03 -[NSObject(NSObject) performSelector:withObject:] + 22
        18  QuartzCore                          0x35f3bbb5 -[CALayer layoutSublayers] + 120
        19  QuartzCore                          0x35f3b96d CALayerLayoutIfNeeded + 184
        20  QuartzCore                          0x35f3b8a7 -[CALayer layoutIfNeeded] + 78
        21  UIKit                               0x325fb5d7 -[UIView(Hierarchy) layoutIfNeeded] + 22
        22  UIKit                               0x326a3775 -[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:] + 356
        23  UIKit                               0x326a2bc1 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 3100
        24  UIKit                               0x326a6677 -[UIWindow _setRotatableViewOrientation:duration:force:] + 54
        25  UIKit                               0x3263a8eb -[UIWindow _updateToInterfaceOrientation:duration:force:] + 74
        26  UIKit                               0x32639551 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 540
        27  UIKit                               0x326390ad -[UIWindow setDelegate:] + 168
        28  UIKit                               0x32638fa9 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 64
        29  UIKit                               0x32637611 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 460
        30  UIKit                               0x326165a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506
        31  UIKit                               0x3261632f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106
        32  UIKit                               0x325fbc1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678
        33  UIKit                               0x325fb96b -[UIView(Hierarchy) addSubview:] + 22
        34  UIKit                               0x3262b35f -[UIWindow addRootViewControllerViewIfPossible] + 202
        35  UIKit                               0x3275653f -[UIWindow setRootViewController:] + 166
        36  DMC to Go                           0x00003055 -[dmcIpadAppDelegate application:didFinishLaunchingWithOptions:] + 792
        37  UIKit                               0x3262b821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772
        38  UIKit                               0x32625b65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272
        39  UIKit                               0x325fa7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
        40  UIKit                               0x325fa215 -[UIApplication sendEvent:] + 44
        41  UIKit                               0x325f9c53 _UIApplicationHandleEvent + 5090
        42  GraphicsServices                    0x358d2e77 PurpleEventCallback + 666
        43  CoreFoundation                      0x32a74a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
        44  CoreFoundation                      0x32a7683f __CFRunLoopDoSource1 + 166
        45  CoreFoundation                      0x32a7760d __CFRunLoopRun + 520
        46  CoreFoundation                      0x32a07ec3 CFRunLoopRunSpecific + 230
        47  CoreFoundation                      0x32a07dcb CFRunLoopRunInMode + 58
        48  UIKit                               0x32624d49 -[UIApplication _run] + 372
        49  UIKit                               0x32622807 UIApplicationMain + 670
        50  DMC to Go                           0x00002927 main + 82
        51  DMC to Go                           0x000028d0 start + 40
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:33:56+00:00Added an answer on May 22, 2026 at 3:33 pm

    You can not delete objects with your managedObjectModel.

    Only the managedObjectContext can delete objects:

    for (AssetFile *afile in cleanedAssetFiles) {
        [afile.managedObjectContext delete:afile];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am playing with TFS 2010, and am trying to setup a build process
I'm trying to write test harness for part of my Android mapping application. I
I'm trying to build a C++ extension for python using swig. I've followed the
I'm trying to build a Chrome browser extension, that should enhance the way the
I am trying to redirect to a specific path based on HTTP_HOST or SERVER_NAME
I am trying to load a html page through UIWebview.I need to disable all
I am trying to understand the practical difference during the execution of a program
I have several USB mass storage flash drives connected to a Ubuntu Linux computer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.