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="SoulRed12" data-source="post: 1037174" data-attributes="member: 146412"><p>Actually I'm learning xCode to eventually develop for the iPhone as an assistant programmer in my father's new company. I'm just writing a mac app to teach myself the basics of xCode. But at any rate, I'll have a look at the stanford course ^_^ Thanks for the recommendation.</p><p></p><p>But actually, I have a problem somewhat related to the first question now...</p><p></p><p>I was trying to change the timing system to use the NSDate, and now I'm having a bit of an issue with this method. I kept the NSTimer so I could update the level indicator every 1/8 second, but for some reason when the timer executes the countDown method, the app freezes. When viewing the console, it brings up something called "gdb" and one time it also said that the "program received signal: EXC_BAD_ACCESS". I have no idea what either of those things are. Here's the method that's causing the problem (you'll see below why I know this):</p><p></p><p>[code]-(void)countDown</p><p>{ </p><p> float barVal;</p><p></p><p> // Set barVal to a float which is the % of time completed</p><p> barVal = (float)[endTime timeIntervalSinceNow] / (float)startSeconds;</p><p> </p><p> [timeBar setFloatValue:ceil(barVal*240)];</p><p> </p><p> // When it's past endTime, call the timeOver method</p><p> if ([endTime timeIntervalSinceNow]<=0) [self timeOver];</p><p>}[/code]</p><p></p><p>The above method is called repeatedly after using this code in the button action method:</p><p></p><p>[code]// note to readers of this post: mainTimer variable created earlier</p><p>mainTimer = [NSTimer scheduledTimerWithTimeInterval:0.125 target:self selector:@selector(countDown) userInfo:nil repeats:YES];[/code]</p><p></p><p>It works if I comment out both the lines of the method that have a call to the timeIntervalSinceNow method; it doesn't work if I only comment out one or the other. I don't know what's wrong...any help appreciated.</p></blockquote><p></p>
[QUOTE="SoulRed12, post: 1037174, member: 146412"] Actually I'm learning xCode to eventually develop for the iPhone as an assistant programmer in my father's new company. I'm just writing a mac app to teach myself the basics of xCode. But at any rate, I'll have a look at the stanford course ^_^ Thanks for the recommendation. But actually, I have a problem somewhat related to the first question now... I was trying to change the timing system to use the NSDate, and now I'm having a bit of an issue with this method. I kept the NSTimer so I could update the level indicator every 1/8 second, but for some reason when the timer executes the countDown method, the app freezes. When viewing the console, it brings up something called "gdb" and one time it also said that the "program received signal: EXC_BAD_ACCESS". I have no idea what either of those things are. Here's the method that's causing the problem (you'll see below why I know this): [code]-(void)countDown { float barVal; // Set barVal to a float which is the % of time completed barVal = (float)[endTime timeIntervalSinceNow] / (float)startSeconds; [timeBar setFloatValue:ceil(barVal*240)]; // When it's past endTime, call the timeOver method if ([endTime timeIntervalSinceNow]<=0) [self timeOver]; }[/code] The above method is called repeatedly after using this code in the button action method: [code]// note to readers of this post: mainTimer variable created earlier mainTimer = [NSTimer scheduledTimerWithTimeInterval:0.125 target:self selector:@selector(countDown) userInfo:nil repeats:YES];[/code] It works if I comment out both the lines of the method that have a call to the timeIntervalSinceNow method; it doesn't work if I only comment out one or the other. I don't know what's wrong...any help appreciated. [/QUOTE]
Verification
Name this item. 🍎
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
A couple xCode questions
Top