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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:38:59+00:00 2026-06-14T04:38:59+00:00

I moved some code that will be used multiple times into a class. I’m

  • 0

I moved some code that will be used multiple times into a class.
I’m not getting errors, but I’m also not getting results. It seems to skip over my class completely.
Ideally, this class is supposed to do NSURL conns and XMLParser stuff to chew up the data feed from our hosting API. I already have this working but wanted to congeal and somewhat normalize/centralize some of the main logic of my code.

The one function ‘bdCheckIfFileExistsAndisValid’ is supposed to take a string but return BOOL and it isn’t being called at all.

Neither is ‘bdParsePlaylistXML’ that is supposed to take a string and return an array.

I put breakpoints everywhere in my class and none are hit.
I’m new so I’m not sure if I did everything right. Here’s some code, thanks in advance.

——————–CUSTOM CLASS:(.h)

@interface bdXMLParser : NSObject {

    NSMutableArray *playlist;

    //Playlist XML info
    BOOL recordTrackName;
    BOOL recordTrackDescription;
    BOOL recordTrackThumbnailAbsoluteLocation;
    BOOL recordTrackURL;
    NSString *TrackName;
    NSString *TrackDescription;
    NSString *TrackThumbnailAbsoluteLocation;
    NSString *TrackURL;

}

-(NSMutableArray*) bdParsePlaylistXML:(NSString *) playlistXMLFileName;

-(BOOL) bdCheckIfFileExistsAndisValid:(NSString *) localFileName;

—————-CUSTOM CLASS (.m):

#import "bdXMLParser.h"

@implementation bdXMLParser
{
    NSMutableData *webData;

    NSMutableArray *playlist;
    NSXMLParser *xmlParserPlaylist;    
}

-(NSString*) bdDocumentsDirectory{
    NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    return documentsPath;
}

-(int) bdCheckFileCreationDate:(NSString *) fileName {

    //get XML file path
    NSString *localFilePath = [[self bdDocumentsDirectory] stringByAppendingPathComponent:fileName];

    //local file check
    NSFileManager *filemgr;
    filemgr = [NSFileManager defaultManager];
    NSDictionary* attrs = [filemgr attributesOfItemAtPath:localFilePath error:nil];
    NSDate *fileCreationDate = [attrs objectForKey: NSFileCreationDate];
    NSDate *rightNow = [NSDate date];
    NSTimeInterval lastDiff = [fileCreationDate timeIntervalSinceNow];
    int lastDiffINT = round(lastDiff);

    NSLog(@"NSFileCreationDate:%@",fileCreationDate);
    NSLog(@"CurrentDate:%@",rightNow);
    NSLog(@"lastDiff:%f",lastDiff);

    return lastDiffINT;    
}

-(BOOL) bdCheckIfFileExistsAndisValid:(NSString *) fileName {    
    //local file check    
    NSString* foofile = [[self bdDocumentsDirectory] stringByAppendingPathComponent:fileName];
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:foofile];

    if ((fileExists == YES) && ([self bdCheckFileCreationDate:foofile] > -86400))//(24 hrs = 86400 seconds)
        return YES;
    else
        return NO;

}

HERE’s THE VIEW WHERE I’M TRYING TO USE IT:(menu.h)

#import "bdXMLParser.h"
@interface MenuScreenViewController : UIViewController <NSXMLParserDelegate>
- (IBAction)btnPlayerPlayPause:(id)sender;

(menu.m)

- (IBAction)btnPlayerPlayPause:(id)sender {
    //if array exists, don't reload xml, dont reparse xml, just go to the view
    if (playlist.count == 0){

        //Playlist!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        //========================================================================
        //1st: check to see if we have a local cached xml data
        //if we do, check if it is <24hr old and if so load it
        //if not, go get it with connection and overwrite/store it

        //init blogs NSMutableArray
        playlist = [[NSMutableArray alloc] init];

        //local file check
        bdXMLParser *myParser;
        BOOL fileExistsAndValid = NO;
=HERE!==fileExistsAndValid = [myParser bdCheckIfFileExistsAndisValid:PlaylistName];        

        //1st
        if (fileExistsAndValid)//(<24 hrs old)
        {
            NSLog (@"File fileExistsAndValid");

=AND HERE!!=playlist = [myParser bdParsePlaylistXML:PlaylistName];
            NSLog(@"playlist:%u", playlist.count);
            //load first track
            [self LoadTrack:0];
        }
        else{

            NSLog (@"File doesn't exist");
            //call refresh function
            //[self refreshAlbumPhotoXML];
            [myParser bdRefreshPlaylistXML];
        }
    }   
}
  • 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-06-14T04:39:00+00:00Added an answer on June 14, 2026 at 4:39 am

    you forgot initing the class

    bdXMLParser *myParser= [[bdXMLParster alloc]init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code(dbName,dbPSWD etc) that must be used in many scripts. I moved
I'm writing some code that will get executed before the DOM loads, basically, using
My company is beginning to write some code using Scala. I've been moved onto
Last evening I did some housekeeping on our code repository - basically moved the
I have some code in ASIHTTP, but I want to move on AFNetworking. I
I moved some hardcoded settings to a custom Section (so I did not use
I have an iPhone app that uses the json-framework . I moved some of
Where should I locate the code for validating an employee ID (badge) that will
What are the current rules for writing python code that will pass cleanly through
I'm having problems with some AS3 code that simply draws on a Sprite 's

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.