usleep() in objective c code
In my objective c code I am using c and c++ libraries. Inside that there is a usleep(20); method used and I am keep on getting a warning "implicit declaration of function 'usleep'". Is it ok to keep this in the code? Can this code chunk can cause to app reject开发者_如何学Cion in App Store?
Thank you.
That’s just a compiler warning. You can keep on using the call, just add this to the top of your code:
#import <unistd.h>
As far as App Store goes it’s perfectly safe.
usleep()
is a relative of sleep()
and nanosleep()
. You can see the pattern; the first takes a parameter in microseconds, the second in seconds, and the third in nanoseconds. Using these methods will put the thread that it was called from to sleep (pause) for the amount of time specified. This is completely legal to use, and I guarantee that your app will not be rejected for its use.
精彩评论