等待,直到在ios中执行委托方法
这是我的代码:等待,直到在ios中执行委托方法,ios,objective-c,Ios,Objective C,这是我的代码: -(void)serverdata:(NSString *)countryname { NSUserDefaults * defaults =[NSUserDefaults standardUserDefaults]; NSString *country = countryname; NSString * devicename = @"IOS"; NSString *device_id = [d
-(void)serverdata:(NSString *)countryname
{
NSUserDefaults * defaults =[NSUserDefaults standardUserDefaults];
NSString *country = countryname;
NSString * devicename = @"IOS";
NSString *device_id = [defaults objectForKey:@"devicetoken"];
NSLog(@"I AM HERE IN THIS FUNCTION %@",device_id);
othercode here to send data to server..
}
if([self checkinternet])
{
[self serverdata:@"Mexico"];
[self performSegueWithIdentifier:@"manualseg" sender:nil];
}
我想等待,直到委托方法在DeviceToken调用的
确实非常感谢,这将是一个很大的帮助。您可以为此尝试计时器功能。像这样的
func deviceTokenTest(){
if(devicetoken){ // Make Boolen variable for identify.
self.loadData()
println("If that true.. you can proceed")
}else{
var Timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("deviceTokenTest"), userInfo: nil, repeats: false)
println("Recall the Function Again")
}
}
在这个函数中。直到
devicetoken
true(如果设备令牌!=nill)函数将每秒钟重新调用一次。希望你能理解。你为什么发布新问题?你应该澄清你以前的问题。@rmaddy因为我认为我以前的问题不太清楚。。这就是为什么你应该修正它而不是发布新问题。@rmaddy很抱歉,但你能帮我整理这个问题吗?我真的很累@rmaddy'UIApplication*appDelegatemethod=[[UIApplication sharedApplication]委托];[appDelegatemethod RegisterForRemotonifications];'xcode中的send异常