I have a function that updates the gps coordinate lat and long then sends a tweet with the lat and long info attached. I want the function to wait until the lat and long are filled before the tweet goes through but it seems to do both at the same time so the lat and long don't get filled in. How do I make the gps location update first?
A:
Have you tried decoupling the 'tweet' function from the lat and long function and have it take in lat and long as parameters? That way, in your lat and long function you set two variables, and then pass them to the tweet function, therefore it won't call it until you call it with the right data.
Something like:
- (void) getLatLong{
int latitude;
int longitude;
latitude= MyClass getLat;
latitude= MyClass getLong;
MyClass tweet:latitude:longitude;
}
- (void) tweet:(int) latitude:(int) longitude{
// send tweet
}
Scott
2010-03-18 17:15:23