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?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
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
My application crash on iOS 16 randomly, stack trace like this:
libswiftCore.dylib __swift_release_dealloc + 32
libswiftNetwork.dylib outlined consume of (@escaping @callee_guaranteed (@in_guaranteed Network.NWConnection.State) -> ())? + 52
libswiftNetwork.dylib outlined consume of (@escaping @callee_guaranteed (@in_guaranteed Network.NWConnection.State) -> ())? + 52
libswiftCore.dylib __swift_release_dealloc + 56
libsystem_blocks.dylib __call_dispose_helpers_excp + 48
libsystem_blocks.dylib __Block_release + 252
libsystem_blocks.dylib bool HelperBase::disposeCapture<(HelperBase::BlockCaptureKind)4>(unsigned int, unsigned char*) + 68
libsystem_blocks.dylib HelperBase::destroyBlock(Block_layout*, bool, unsigned char*) + 180
libsystem_blocks.dylib __call_dispose_helpers_excp + 72
libsystem_blocks.dylib __Block_release + 252
libdispatch.dylib ___destroy_helper_block_8_32c35typeinfo name for dispatch_block_private_data_s + 96
libsystem_blocks.dylib __call_dispose_helpers_excp + 48
libsystem_blocks.dylib __Block_release + 252
libdispatch.dylib __dispatch_client_callout + 20
libdispatch.dylib __dispatch_root_queue_drain + 684
libdispatch.dylib __dispatch_worker_thread2 + 164
libsystem_pthread.dylib __pthread_wqthread + 228
From buly(a tool to report crash) we notice that this crash only happens on iOS 16
Topic:
Programming Languages
SubTopic:
Swift
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);
}