Create a new mac os app in Xcode 14.
Fetch camera list by these code:
NSArray *devicesIOS = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
then change the architecture to x86_64
snd add com.apple.security.device.camera to entitlements
then this code will cost 4s and UI will be stuck during next half minutes on M1 machine running MacOS 13
This causes a lot of apps stuck at starting like Zoom and Classin
How to solve this?
Post
Replies
Boosts
Views
Activity
I created an WKWebView, but it can not load "https://www.baidu.com"
and also it keeps calling decidePolicyForNavigationAction function
it works well for other website
@interface ViewController()
@property (nonatomic, strong) WKWebView* webview;
@end
@implementation ViewController
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.webview = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 500, 500)];
[self.view addSubview:self.webview];
self.webview.navigationDelegate = self;
NSURL* url = [NSURL URLWithString:@"https://www.baidu.com"];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:request];
// [self.webview reload];
}
(void)setRepresentedObject:(id)representedObject {
[super setRepresentedObject:representedObject];
// Update the view, if already loaded.
}
(void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler{
decisionHandler(WKNavigationActionPolicyAllow, preferences);
}
Instruments freeze when WKWebView is created
I create a very simple mac os application
If I create a WKWebView like this
"
(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.webview = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 500, 500)];
}
"
Then the instruments freeze when I record allocations
Why?
If I remove the creation of WKWebView, everything works fine
I'm using Xcode 14.2