Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
I'm feeling so silly right now :eek:

if i'm to go by what i've read above it's
Code:
NSString *aString = [NSString stringWithFormat: @"%f", doubleValue];

PLEASE be right :D

No.

You don't be right by wildly guessing like that.

Google "NSString Class Reference". Apple's reference documents should be the top result. There's a section that has something to do with Getting Numeric Values. One of the methods in that section returns a double, which has been parsed from the instance of NSString that you call the method on.

And we don't need to see your zip because you're sharing enough code that we can see what you're doing wrong already (or at least we're seeing some of what you're doing wrong.)
 
Last edited by a moderator:
No.

You don't be right by wildly guessing like that.

Google "NSString Class Reference". Apple's reference documents should be the top result. There's a section that has something to do with Getting Numeric Values. One of the methods in that section returns a double, which has been parsed from the instance of NSString that you call the method on.

And we don't need to see your zip because you're sharing enough code that we can see what you're doing wrong already (or at least we're seeing some of what you're doing wrong.)

Thanks :D

i have found this:

Code:
- (double)doubleValue {

}

i'll see if i can figure out how to get this working
 
Last edited by a moderator:
I'm feeling so silly right now :eek:

if i'm to go by what i've read above it's
Code:
NSString *aString = [NSString stringWithFormat: @"%f", doubleValue];

PLEASE be right :D

Nope.

What you posted would convert a double into a string. You want to go the other way.

The method doubleValue is a method of NSString.

So, you would want

Code:
latitude = [hazardsLatitude methodName];

Where methodName is the name of the method you want. What did the other poster say the method name was?
 
Last edited by a moderator:

Code:
- (double) doubleValue {
// Not sure what goes here TBH
}

latitude = [hazardsLATITUDE doubleValue]; // convert the string hazardsLatitude to a double here
        longitude = [hazardsLATITUDE doubleValue]; // convert the string hazardsLongitude to a double here
 
Last edited by a moderator:
Code:
- (double) doubleValue {
// Not sure what goes here TBH
}

latitude = [hazardsLATITUDE doubleValue]; // convert the string hazardsLatitude to a double here
        longitude = [hazardsLATITUDE doubleValue]; // convert the string hazardsLongitude to a double here

Now that looks promising! Why not try it?
 
Last edited by a moderator:
It's crashing on me unfortunately:

Control reaches end of non-void function

- (double)doubleValue {

}

I have nothing in the doubleValue, should I ?



You don't understand the language at all, do you?

What you have above is the declaration of a method doubleValue.

That would be code that would be inside the .m file for NSString.

You don't need to write that code. You need to use the code that you posted previously,

Code:
latitude = [myLatitudeString doubleValue];

(put your variable names in as appropriate)
 
Maybe Duncan's right, it looks like I don't understand this language at all :(

It seems so. On that note, what resources are you using to learn the fundamentals of Objective-C? Please be as specific as possible.

I would suggest you step away from the real coding for now and spend some time getting comfortable with the basics and then return to this issue when you think you're ready. Hopefully, by then the answer will be obvious.
 
It seems so. On that note, what resources are you using to learn the fundamentals of Objective-C? Please be as specific as possible.

I would suggest you step away from the real coding for now and spend some time getting comfortable with the basics and then return to this issue when you think you're ready. Hopefully, by then the answer will be obvious.

Thanks, I've never programmed before and just read Big Nerds Ranch so this is my first attempt at a program.

I've managed to have build the app with no issues but it's crashing on startup so i'll leave it here for now and see what i can figure out for myself.

Thanks for everything
 
Which BNR book? Remember, I asked politely for specificity.

And how far have you read? Are you finished?

Hahahaha sorry :) I've purchased two, BNR Objective-C Programming & BNR iOS Programming and no I haven't completed the books. I'm going to concentrate on the Objective-C one and finish it and try and understand it better before moving on
 
With what you've done I wouldn't even think that your code compiles (the control reaches end of non-void function, I mean.)
 
With what you've done I wouldn't even think that your code compiles (the control reaches end of non-void function, I mean.)

failing to return a value from a method that defines a return value throws a warning, not an error.

To the OP:

You should treat warnings as errors. If you see a warning, stop and fix it. Warnings only show up the first time you compile a source file. If you go on with your development and change other files, without changing the file with the warning in it, Xcode won't recompile the file with the warning in it and you won't see the warning again.


In fact, it's not a bad idea to set the "treat warnings as errors" flag in your project settings. You should only turn that setting off in rare cases where you have a warning that REALLY IS harmless, and can't be defeated. (Usually this is because you're using a third party library that does not follow a "zero tolerance" policy for warnings.)

----------

Hahahaha sorry :) I've purchased two, BNR Objective-C Programming & BNR iOS Programming and no I haven't completed the books. I'm going to concentrate on the Objective-C one and finish it and try and understand it better before moving on

You should stop and read the Objective C book cover to cover, and do all the exercises. Right now your reach exceeds your grasp. You need a better grounding in the basics of the language before you tackle something as complex as the map kit.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.