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 7677597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:27:28+00:00 2026-05-31T17:27:28+00:00

My application appears to work fine when deployed to my iPhone via Xcode however

  • 0

My application appears to work fine when deployed to my iPhone via Xcode however now that it is on the app store when I download it, it crashes. It must have worked for Apple as like this it would never have passed review????

I have tried other phones but they crash also. From looking at the crash logs the code below is the area of concern.

    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
    // Do a tasks in the background
    library = [[ALAssetsLibrary alloc] init];   

    NSMutableArray *itemFileName = [[NSMutableArray alloc] init];

    for (Item *it in tag.Items) {
        [itemFileName addObject:it.name];
    }

    void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *asset, NSUInteger index, BOOL *stop) {
        if(asset != NULL && [asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto) {

            ALAssetRepresentation *rep = [asset defaultRepresentation];
            NSString *fileName = [rep filename];



            if ([itemFileName containsObject:fileName]) {
                AssetView *assetView = [[AssetView alloc] initWithAsset:asset];
                assetView.delegate = self;
                assetView.fileName = fileName;
                //assetView.index = counter;
                [self.assetViews addObject:assetView];
                //NSLog(@"%i",index);

            }

        }
    };

    void (^assetGroupEnumerator)( ALAssetsGroup *, BOOL *) =  ^(ALAssetsGroup *group, BOOL *stop) {
        if(group != nil) {
            [group enumerateAssetsUsingBlock:assetEnumerator];
        }
        else{
            //[self performSelectorOnMainThread:@selector(reloadTableView) withObject:nil waitUntilDone:YES];
            // Hide the HUD in the main tread 
            dispatch_async(dispatch_get_main_queue(), ^{
                [self reloadTableView];
                [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
                [self loadImageTags];

                if([self.assetViews count] != [tag.Items count]){
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Info" 
                                                                    message:@"Some items have been deleted from the device. If none remain for this tag it will be deleted."  
                                                                   delegate:self 
                                                          cancelButtonTitle:nil 
                                                          otherButtonTitles: @"OK", nil];
                    [alert show];

                    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
                    hud.labelText = @"Cleaning...";

                    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
                        [self clearupOrphanedItems];

                        dispatch_async(dispatch_get_main_queue(), ^{
                            [MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
                        });

                    });
                }                
            });
        }
    };

    // Group Enumerator Failure Block
    void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) {

        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Album Error: %@ - %@", [error localizedDescription], [error localizedRecoverySuggestion]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];

        NSLog(@"A problem occured %@", [error description]);                                     
    };  

    // Enumerate Albums
    [library enumerateGroupsWithTypes:ALAssetsGroupAll
                           usingBlock:assetGroupEnumerator 
                         failureBlock:assetGroupEnumberatorFailure];   //HERE IS WHERE IT DIES!!!     

});

I am not sure if the issue is to due with instantiating the ALAssetLibrary inside the block as either it way to works fine during debugging or even just if deployed to phone via Xcode

Can anyone shed some light on this for me?

  • 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-31T17:27:29+00:00Added an answer on May 31, 2026 at 5:27 pm

    To avoid coredata and threading issues, please make sure:
    1) that you create only one alassetslibrary Instance for the complete lifecycle of the application. Therefore its recommended you initialize your assetslibrary Instance either in the appdelegate or using dispatch_once
    2) Make sure you create the alassetslibrary Instance on the Main thread.

    Cheers,

    Hendrik

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple UITableviewController that used to work fine and now something has
Single sign on appears to work properly for my application and a number of
The Application.WindowBeforeDoubleClick event for PowerPoint 2007 appears to not work (see here to verify
I'm trying to use a blowfish cipher inside an Android application. It appears that
Alright, so I wrote a custom VMR9 Allocator/Presenter which seems to work fine. However,
Until now deploying my Application with macdeployqt worked fine, but after upgrading to Qt
The simple curve in this application only appears when it's dragged off the screen,
Something is interrupting threads in my application. It appears to happen when the JVM
I'm trying to set java.awt.headless=true during the application startup but it appears like I'm
I added a simple ajax modal popup extender to my asp.net application. It appears

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.