Pregunta

I'm trying to hook into the UIActivityViewController as I need to stop some code from running whilst the view is open.

When the view is closed, I need to start my class again.

UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[activityController setTitle:code];
[activityController setExcludedActivityTypes:self.excludedItems];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed) {
    self.label.text = @"Scanning...";
    [self.qrScannerView start];
}];

And when it's opened, I need to stop it:

[self presentViewController:activityController animated:YES completion:^{
    [self.qrScannerView stop];
}];

This seems to work once, but afterwards it'll continue to do run. What am I doing wrong?

¿Fue útil?

Solución

This was caused by my custom class changing the values of stopped and started too soon, so I could never close.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top