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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:24:43+00:00 2026-06-01T08:24:43+00:00

I have a view in a nib, which is linked to a property in

  • 0

I have a view in a nib, which is linked to a property in my viewcontroller with the following line:

@property (unsafe_unretained, nonatomic) IBOutlet UIView *otherView;

It is unsafe_unretained because we are targeting ios 4 devices, but using ARC.

We are getting a crash because the otherView is being deallocated when we are trying to show it, and I’m not too sure why. I’ve put a breakpoint in viewWillAppear, and if I do “po otherView” in the debugger, i get:

<UIView: 0x6fcc880; frame = (0 0; 320 460); autoresize = RM+BM; layer = <CALayer: 0x6fcc8b0>>

I checked it at the end of the viewWillAppear method, and it is still there too. But then if I put a breakpoint at the beginning of viewDidAppear, I get:

0x6fcc880 does not appear to point to a valid object.

Can anyone point me in the right direction with this? If I change the property declaration to ‘Strong’, then this issue doesn’t occur, and I understand that by changing it to Strong that I am retaining it (and therefore preventing it from being deallocated), but I don’t think I should need to do this?

Regards,
Nick

  • 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-01T08:24:45+00:00Added an answer on June 1, 2026 at 8:24 am

    You need to have a retained property (strong | retain) on any topLevel objects from a xib.

    enter image description here

    In this example above view1 would need to have a retained property. view2 does not require a retained property but I generally just leave it as retained anyway as it does not hurt anything.


    Why is the retain not required?

    view2 does not require a retained property because it is owned by view1 and any references you haveare arbitrary references between objects that do not imply ownership. (Apple, Resource Programming Guide). But it doesn’t hurt to have a retained property either, just make sure to call self.view2 = nil in viewDidUnload

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

Sidebar

Related Questions

I have a ViewController with a nib which have a UIView and a UITableView
I have a custom toolbar view which I'm storing in its own nib file.
I have a button in a Nib based view which does not behave like
I have a viewcontroller with a nib - which has a tableview, searchbar and
I have a view setup in Interface Builder which contains a viewController that loads
I have a ViewController in which its nib file contains an image and I
I have a root view controller with no nib file, I tried adding this
I have a simple custom view that is connected via outlet to a NIB.
i have a problem with switch view between 2 views with nib files !
I have a simple UIViewController whose view is created via a Nib. Here's the

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.