开发者

Start one function after another finished iphone

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 functio开发者_如何学编程n 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?


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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜