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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:08:31+00:00 2026-06-08T16:08:31+00:00

I’m having a very weird problem, that I think I know why I’m getting

  • 0

I’m having a very weird problem, that I think I know why I’m getting it but I can’t seem to think of a fix. I am convinced there is no compiler bug here. I have had many of those and all of them occurred because of my faulty code.

Basically, I have a view controller called UnlockKeyboardViewController that inherits from UIViewController, and a custom view (inheriting directly from UIView) called UnlockKeyboard. The header for UnlockKeyboard looks like this:

@interface UnlockKeyboard : UIView
{
    NSArray *buttons;
    NSArray *passcodeFields;

    UIImage *buttonBackgroundImage;
    UIImage *buttonBackgroundHighlightedImage;
    UIImage *middleButtonBackgroundImage;
    UIImage *middleButtonBackgroundImageHighlighted;
    UIImage *screenBackgroundImage;

    UIImage *infoViewContainerImage;
    UIImage *keypadViewContainerImage;
    UIImage *passcodeFieldsContainerImage;

    UIImage *infoViewImage;
    UIImage *passcodeViewImage;

    UIView *infoViewContainer;
    UIView *keypadViewContainer;
    UIView *passcodeFieldsContainer;

    UIView *infoView;
    UIView *keypadView;
    UIView *passcodeFieldsView;

    UIView *infoToDisplayView; //The view the programmer passes to show in infoView.
}
@property(nonatomic, retain)UIImage *buttonBackgroundImage;
@property(nonatomic, retain)UIImage *buttonBackgroundHighlightedImage;
@property(nonatomic, retain)UIImage *screenBackgroundImage;
@property(nonatomic, retain)UIImage *keypadViewBackgroundImage;
@property(nonatomic, retain)UIImage *infoViewContainerImage;
@property(nonatomic, retain)UIImage *keypadViewContainerImage;
@property(nonatomic, retain)UIImage *passcodeFieldsContainerImage;
@property(nonatomic, retain)UIImage *infoViewImage;
@property(nonatomic, retain)UIImage *passcodeViewImage;
@property(nonatomic, retain)UIView *infoToDisplayView;

//Properties for container views.
@property(nonatomic, retain)UIView *infoViewContainer;
@property(nonatomic, retain)UIView *keypadViewContainer;
@property(nonatomic, retain)UIView *passcodeFieldsContainer;

@end

The UnlockKeyboardViewController implementation looks like this so far:

@implementation UnlockKeyboardViewController
-(id)init
{
    if((self = [super init]))
    {
        self.view = [[UnlockKeyboard alloc] init];
    }
    return self;
}

-(void)viewDidLoad
{
    [super viewDidLoad];
}

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [UIView animateWithDuration:0.7 animations:^{
        self.view.keypadViewContainer.frame = CGRectMake(0, 261, 320, 200);
    } completion:^(BOOL finished){

    }];
}

-(void)dealloc
{
    [super dealloc];
}
@end

This is were my problem gets interesting. Whenever I try to compile, the Terminal (this is a jailbreak app, so no Xcode) gives me the following error:

In function ‘void __-[UnlockKeyboardViewController viewDidAppear:]_block_invoke_1(void*)’:
Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

BUT, this error only appears when I have this line in:

self.view.keypadViewContainer.frame = CGRectMake(0, 261, 320, 200);

If I don’t that line in my animation block, the compiler won’t give me that error and it wil compile just fine. Although, no matter were I put this line, I always get segmentation line 11.

I THINK this may have something to do with the fact that UIView doesn’t have a member called keypadViewContainer, although UnlockKeyboard has that property and is a subclass of UIView. I believe this is happening because the compiler can’t actually see the class hierarchy between UIView and UnlockKeyboard.

If I’m right, I have no idea of how to go around the problem. Been thinking for a while. Any input to help me solve this problem will be really appreciated.

  • 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-08T16:08:35+00:00Added an answer on June 8, 2026 at 4:08 pm

    First, you should only set a view controller’s view property in its loadView method:

    - (void)loadView
    {
        self.view = [[UnlockKeyboard alloc] init];
    }
    

    This will trigger other methods, such as viewDidLoad, that will expect the object to have been full initialized. Moral of the story: don’t set the view property until the controller asks you to.

    Then, in your viewDidAppear: method, casing the view property into the specific subclass you are using should avoid any warnings and hopefully also that weird compiler crash:

    [UIView animateWithDuration:0.7 animations:^{
        UnlockKeyboard *ukView = (UnlockKeyboard *)self.view;
        ukView.keypadViewContainer.frame = CGRectMake(0, 261, 320, 200);
    

    The code as you have written it should have triggered a compiler warning, because the property keypadViewContainer isn’t defined on UIView (the type of the expression self.view).

    The type cast is admittedly a little bit ugly, but it’s necessary since the view controller is a generic parent class and doesn’t know what kind of view it is controlling. You may find it useful to define a property that eliminates the need to do the cast all the time:

    @property (nonatomic,readonly) UnlockKeyboard *unlockKeyboardView;
    

    And the corresponding method:

    - (UnlockKeyboard *)unlockKeyboardView
    {
        return self.view;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
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
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.