Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective-C-调用performSelector_Objective C_Performselector - Fatal编程技术网

Objective-C-调用performSelector

Objective-C-调用performSelector,objective-c,performselector,Objective C,Performselector,目前,我正尝试使用以下代码行调用选择器: [self performSelector:@selector(locationManager:) withObject:nil afterDelay:searchAnimation.animationDuration]; 我尝试调用的方法是: -(void)locationManager:(CLLocationManager *)manager didRangeBeacons: (NSArray *)beacons inRegion:(CLB

目前,我正尝试使用以下代码行调用选择器:

    [self performSelector:@selector(locationManager:) withObject:nil afterDelay:searchAnimation.animationDuration];
我尝试调用的方法是:

-(void)locationManager:(CLLocationManager *)manager didRangeBeacons: (NSArray *)beacons inRegion:(CLBeaconRegion *)region { NSLog(@"check"); }
有人能帮我吗。这不起作用,因为未声明选择器。地点经理:名字在这儿吗

否则我怎么能调用这个函数呢

坦克

编辑您不能使用PerformSelect在这种情况下,它只接受0或1个参数。谢谢@rmaddy

我不明白你想要实现什么,但也许你应该使用

例如:


希望有帮助:

您不能使用performSelector。。。方法,因为选择器有多个参数。您必须使用dispatch_after函数并直接调用该方法。如果您不想向该函数发送参数,当然可以。无论如何,我认为你应该更好地阅读我的答案,我建议使用dispatch_after。干杯,不行。在本例中,选择器接受3个参数。performSelector:withObject:afterDelay:的文档明确说明选择器必须采用0或1个参数。是的,我同意你的意见,你应该在之后使用dispatch_。那部分是对的,对不起,你说得对。我有一个类别具有不同的performSelector,它使用NSInvocation处理多个参数。很抱歉我将编辑答案以使其正确。非常感谢:选择器是locationManager:didRangeBeacons:inRegion:,不多也不少。
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(searchAnimation.animationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
     <# call the delegate method here #>
});