在视图出现之前预加载AVCaptureSession(Swift)

时间:2016-08-05 01:31:42

标签: ios objective-c iphone swift

我有两个<?php $post_data = file_get_contents('php://input'); $post_array = explode('&', $post_data); $dataFromPayPal = array(); foreach ($post_array as $keyval) { $keyval = explode ('=', $keyval); if (count($keyval) == 2) $dataFromPayPal[$keyval[0]] = urldecode($keyval[1]); } $req = 'cmd=_notify-validate'; if(function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach ($dataFromPayPal as $key => $value) { if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { $value = urlencode(stripslashes($value)); } else { $value = urlencode($value); } $req .= "&$key=$value"; } $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); //use https://www.paypal.com/cgi-bin/webscr in live environment. curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); if( !($res = curl_exec($ch)) ) { curl_close($ch); exit; } curl_close($ch); if (strcmp ($res, "INVALID") == 0) { echo "INVALID"; } else if (strcmp ($res, "VERIFIED") == 0) { echo "VALID"; } ?> (vc1,vc2)。 vc2有一个View Controllers,一旦视图出现就会加载。当vc2出现时,我希望AVCaptureSession在视图出现之前已经打开,而不是从AVCaptureSession加载相机。因此,如果用户在vc1上,则vc2上的AVCaptureSession已经开始,并且当用户移动到vc2时,可以避免打开相机动画。有可能这样做吗?

我试图将AVCaptureSession打开到AVCaptureSession,但结果相同。

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

如果可以使用委托函数调用,那将是很好的,在VC1的viewDidLoad中调用VC2的方法。您还需要启动VC2。因此,当你转移到VC2时,你有AVCaptureSession。