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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:13:21+00:00 2026-05-27T20:13:21+00:00

I did the Build and analyze in xCode and get Dereference of null pointer

  • 0

I did the “Build and analyze” in xCode and get “Dereference of null pointer” . I noted in my code below for which row I get the message. I’m developing for iPhone.

“PDFScrollView.h”

 #import "ENsightAppDelegate.h"
@interface PDFScrollView : UIScrollView <UIScrollViewDelegate> {

ENsightAppDelegate *appDelegate;
}

 @end

“PDFScrollView.m”

 - (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {

    // Set up the UIScrollView
    self.showsVerticalScrollIndicator = NO;
    self.showsHorizontalScrollIndicator = NO;
    self.bouncesZoom = YES;
    //self.decelerationRate = UIScrollViewDecelerationRateFast;
    self.delegate = self;
    [self setBackgroundColor:[UIColor grayColor]];
    self.maximumZoomScale = 5;//200
    self.minimumZoomScale = 0.5;//.85
    self.userInteractionEnabled = YES;
    self.delaysContentTouches = YES;
    self.canCancelContentTouches = NO;

}
appDelegate =(ENsightAppDelegate *) [[UIApplication sharedApplication] delegate];
pdfView=[appDelegate GetLeaveView];
[self addSubview:pdfView];
return self;

}

It’s not the complete code, pasted what I think is useful.

I find this quite strange. How come I get this message?

enter image description here

  • 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-27T20:13:22+00:00Added an answer on May 27, 2026 at 8:13 pm

    If self is nil, then you can’t access instance variables of ‘self’. So you should reference those variables only inside of the if statement. In other words, only if self is not nil.

    - (id)initWithFrame:(CGRect)frame {
    
       if ((self = [super initWithFrame:frame])) {
    
          // Set up the UIScrollView
          self.showsVerticalScrollIndicator = NO;
          // ... bunch of other properties set...
          // ... btw, better style here would be to set the ivars directly (in an initializer)
    
          appDelegate =(ENsightAppDelegate *) [[UIApplication sharedApplication] delegate];
          pdfView=[appDelegate GetLeaveView];
          [self addSubview:pdfView];
        }
    
        return self;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to bulk update? I did a build insert, now I would
On my first job interview, I was asked why did I build my own
Did you ever had a bug in your code, you could not resolve? I
I've just mad Build and Analyze with my project on iphone, and i got
I just did a clean build and reinstall of lighttpd 1.4.20 on Mac OS
I'm trying to build dschaefer android-box2d , and did follow the recipe. I do
i added a new mysql table and did a build-schema my config/schema.yml contains my
I did a build of my SharePoint site template solution assembly and successfully deployed
I downloaded gcc 4.6.2 (with GMP, MPFR, and MPC) and did a build. I
I did build ffmpeg for Android in winxp and scientific linux , ffmpeg is

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.