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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:28:02+00:00 2026-06-06T14:28:02+00:00

I’m doing an iOS app that crawl my youtube subscription’s videos. I have a

  • 0

I’m doing an iOS app that crawl my youtube subscription’s videos.
I have a problem when I want to navigate to see the next videos at the third time.

for these, I need to collect the start-index (NSNumber *youtubeStart) to add it the number of videos displayed (int const maxVideos).

For that, I have in my VideosViewController.h

@interface VideosViewController : UIViewController {
    NSNumber *youtubeStart;
}

@property (nonatomic, retain) NSNumber *youtubeStart;

Then in VideosViewController.m

@synthesize youtubeStart;
static int const maxVideos = 6;

And a method that do

- (void) navigateVideos:(id)sender
{
    int navigate = 0;
    int start = [youtubeStart intValue];

    if(sender == bt_prev)
    {
        if(start >= maxVideos)
        {
            start -= maxVideos;
            navigate = 1;
        }
    }

    if(sender == bt_next)
    {
        start += maxVideos;
        navigate = 1;
    }

    if (navigate > 0)
    {   
        youtubeStart = [NSNumber numberWithInt:start];
        NSString *url = [NSString
             stringWithFormat:@"%@&start-index=%i&max-results=%i"
             , myUrl, [youtubeStart intValue], maxVideos];
        [self LoadOAuthUrl:url];
    }
}

When I “TouchUpInside” one of the buttons “bt_prev” or “bt_next” it call “navigateVideos”.
I can press bt_prev or bt_next as many times as I want and it works but if I press bt_next 3 times in a row, youtubeStart become out of scope. It seems to not be able to go further than the third page.

Could you help me to understand why and how to handle it.

My others synthesized variables are not out of scope.

Thanks a lot for your help.

EDIT: I run the application on the ipad simulator from x-code. The application just crash with the EXC_BAD_ACCESS error. youtubeStart appear to be “out of scope” in the debugger just before “int start = [youtubeStart intValue];” and that’s why it crash. When it works fine, youtubeStart is not out of scope.

EDIT 2:
The stacktrace is always missing.
I just got this in the debugger console:

Program received signal:  “EXC_BAD_ACCESS”.

And this in the debugger with a red arrow:

0x0134d0b0  <+0036>  cmp    ecx,DWORD PTR [eax]
  • 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-06T14:28:04+00:00Added an answer on June 6, 2026 at 2:28 pm

    This problem is caused by you not using properties properly. You should always use self.youtubeStart when you assign a new value to the youtubeStart property. This is so that the object can be retained by your property. When you just assign directly to the iVar the actual NSNumber object is not retained, which means by the time you access it later (like when you call start = [youtubeStart intValue]) the object may have been auto-released.

    I’m guessing that the ‘out of scope’ error really means that the object has been deallocated.

    Here’s what I would recommend…

    Remove this code at the @interface in VideosViewController.h:

    {
        NSNumber *youtubeStart;
    }
    

    And change your @synthesize to this:

    @synthesize youtubeStart = _youtubeStart;
    

    Then you will get some compiler errors/warnings where you directly access youtubeStart from within your code. Fix these by changing the access to self.youtubeStart.

    This is a really good practice for using properties because it makes sure you don’t ever accidentally use the iVar directly. If you do want to use the iVar directly, you can use _youtubeStart (this iVar is created automatically by the @synthesize line). However I recommend not using it at all unless you fully understand how the accessors and retain etc. works.

    Also, if you struggle with this stuff I highly recommend looking into ARC 🙂

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't

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.