Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
A couple xCode questions
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="xstep" data-source="post: 1037333" data-attributes="member: 11647"><p>The fact that you get a crash at those NSLog()s suggests your endTime ivar isn't set, or you are not retaining it after setting it.</p><p></p><p>When is it crashing; upon opening the application, or when hitting the 'Start' button?</p><p></p><p>If it crashes at startup, then it sounds like you are initiating your timer when you haven't set things up yet. Specifically endTime. Your interface suggests that you are not initiating your timer because you haven't designated the obvious methods; awakeFromNib or init.</p><p></p><p>If it crashes when hitting the start button, have you used the slider yet to assign a value to endTime? What is the code that sets up endTime look like?</p><p></p><p>You need to look into Objective-C memory management. On the iPhone OS, you are responsible for it. Here is a <a href="http://cocoadevcentral.com/d/learn_objectivec/" target="_blank">link</a> that covers some of it. There are several good tutorials at Cocoadevcentral.</p><p></p><p>The general rule for when you get a retained object back from classes is weather you have used the alloc, copy, or new class methods to create your object. If you have not, then you have an autoreleased object that you need to apply the retain method to if you want to keep it beyond the method you are in, even when that object is declared in your interface. Objects that are autoreleased get released at the end of the event loop. I'll leave it up to you to read about this. It is critical that you understand this and is to long to describe here.</p></blockquote><p></p>
[QUOTE="xstep, post: 1037333, member: 11647"] The fact that you get a crash at those NSLog()s suggests your endTime ivar isn't set, or you are not retaining it after setting it. When is it crashing; upon opening the application, or when hitting the 'Start' button? If it crashes at startup, then it sounds like you are initiating your timer when you haven't set things up yet. Specifically endTime. Your interface suggests that you are not initiating your timer because you haven't designated the obvious methods; awakeFromNib or init. If it crashes when hitting the start button, have you used the slider yet to assign a value to endTime? What is the code that sets up endTime look like? You need to look into Objective-C memory management. On the iPhone OS, you are responsible for it. Here is a [URL="http://cocoadevcentral.com/d/learn_objectivec/"]link[/URL] that covers some of it. There are several good tutorials at Cocoadevcentral. The general rule for when you get a retained object back from classes is weather you have used the alloc, copy, or new class methods to create your object. If you have not, then you have an autoreleased object that you need to apply the retain method to if you want to keep it beyond the method you are in, even when that object is declared in your interface. Objects that are autoreleased get released at the end of the event loop. I'll leave it up to you to read about this. It is critical that you understand this and is to long to describe here. [/QUOTE]
Verification
Name this item. 🍎
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
A couple xCode questions
Top