VisionKit

RSS for tag

Scan documents with the camera on iPhone and iPad devices using VisionKit.

Posts under VisionKit tag

169 Posts

Post

Replies

Boosts

Views

Activity

Vision Pro Dev Kit question
Hi guys, has any individual develper received Vision Pro dev kit or is it just aimed at big companies? Basically I would like to start with one or 2 of my apps that I removed from the store already, just to get familiar with VisionOS platform and gain knowledge and skills on a small, but real project. After that I would like to use the Dev kit on another project. I work on a contract for mutlinational communication company on a pilot project in a small country and extending that project to VisionOS might be very interesting introduction of this new platform and could excite users utilizing their services. However I cannot quite reveal to Apple details for reasons of confidentiality. After completing that contract (or during that if I manage) I would like to start working on a great idea I do have for Vision Pro (as many of you do). Is it worth applying for Dev kit as an individual dev? I have read some posts, that guys were rejected. Is is better to start in simulator and just wait for actual hardware to show up in App Store? I would prefer to just get the device, rather than start working with the device that I may need to return in the middle of unfinished project. Any info on when pre-orders might be possible? Any idea what Mac specs are for developing for VisionOS - escpecially for 3D scenes. Just got Macbook Pro M3 Max with 96GB RAM, I'm thinknig if I should have maxed out the config. Anybody using that config with Vision Pro Dev kit? Thanks.
0
0
1.5k
Dec ’23
IP Camera support SDK for iOS Devices
I was looking for IP camera which is not very expensive. The key point is I should be able to convert its frames to CMSampleBuffer I would like to use images to make some basic analysis using Vision. So far I could not find any IP camera manufacturer supports SDK for Swift and iOS for this kind of study.
0
0
661
Nov ’23
DataScannerViewController could not get torch on when scanning.
I use DataScannerViewController to scan barcode and text recognize, and then get the AVCaptureDevice to use torch on/off, but DataScannerViewController will stop scanning. DataScannerViewController has no related API to get AVCaptureDevice to use torch. Expected: Could use AVCaptureDevice to turn on/off torch, at the same time DataScannerViewController could scan.
0
0
744
Nov ’23
Delegate methods of ImageAnalysisInteractionDelegate don't fire
I have a live text implementation on the following LiveTextImageView. However, after the view loads and the analyze code is run, none of the delegate methods fire when I interact with the Live View. Selecting text does not fire the textSelectionDidChange method, nor does highlightSelectedItemsDidChange fire when the live text button in the bottom right is pressed. I tried a few different implementations, including an approach where the delegate was defined on a separate class. I am running this on a iPhone 12 Pro I recently updated to 17.0.3. My goal is to be able to provide additional options to the user beyond the default live-text overlay options, after identifying when they have finished selecting text. // // LiveTextImageView.swift // import UIKit import SwiftUI import VisionKit class ImageAnalyzerWrapper { static let shared = ImageAnalyzer() private init() { } } struct LiveTextImageViewRepresentable: UIViewRepresentable { var image: UIImage func makeUIView(context: Context) -> LiveTextImageView { return LiveTextImageView(image: image) } func updateUIView(_ uiView: LiveTextImageView, context: Context) { } } class LiveTextImageView: UIImageView, ImageAnalysisInteractionDelegate, UIGestureRecognizerDelegate { var capturedSelectedText: String? let analyzer = ImageAnalyzerWrapper.shared let interaction = ImageAnalysisInteraction() init(image: UIImage) { super.init(frame: .zero) self.image = image let photoWrapper = PhotoWrapper(rawPhoto: image) let resizedPhoto = photoWrapper.viewportWidthCroppedPhoto(padding: 40) self.image = resizedPhoto self.contentMode = .scaleAspectFit self.addInteraction(interaction) interaction.preferredInteractionTypes = [] interaction.analysis = nil analyzeImage() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func analyzeImage() { if let image = self.image { Task { let configuration = ImageAnalyzer.Configuration([.text]) do { let analysis = try await analyzer.analyze(image, configuration: configuration) self.addInteraction(interaction) interaction.delegate = self interaction.analysis = analysis interaction.preferredInteractionTypes = .textSelection } catch { print("Error in live image handling") } } } } func interaction( _ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) async { print("Highlighted items changed") } func interaction(_ interaction: ImageAnalysisInteraction, shouldBeginAt point: CGPoint, for interactionType: ImageAnalysisInteraction.InteractionTypes) async -> Bool { return interaction.hasInteractiveItem(at: point) || interaction.hasActiveTextSelection } func textSelectionDidChange(_ interaction: ImageAnalysisInteraction) async { print("Changed!") if #available(iOS 17.0, *) { capturedSelectedText = interaction.text print(capturedSelectedText ?? "") } } }
0
0
1k
Oct ’23
Runtime crash on iOS16 when iOS17 framework is mentioned
Hi Everyone, I'm having a strange crash on App launch with iOS16 when I have a reference to an iOS17 only framework in my code. Even if I wrap the code in #available, I still get the crash on launch; and the code isn't even called yet... just the existence of it causes the crash. Pretty strange I thought? The framework is VisionKit, and the code that causes the crash is if #available(iOS 17, *) { // .imageSubject is iOS17 only - but this causes // a crash on launch in iOS16 even with the #available check interaction.preferredInteractionTypes = .imageSubject } The crash is: Referenced from: <91ED5216-D66C-3649-91DA-B31C0B55DDA1> /private/var/containers/Bundle/Application/78FD9C93-5657-4FF5-85E7-A44B60717870/XXXXXX.app/XXXXXX Expected in: <AF01C435-3C37-3C7C-84D9-9B5EA3A59F5C> /System/Library/Frameworks/VisionKit.framework/VisionKit Any thoughts anyone?? I know the .imageSubject is iOS17 only, but the #available should catch it - no? Any why does it crash immediatley on launch, when that code is not even called? Odd!
1
1
1.1k
Oct ’23
iOS app crashed on iOS 16
Hi team, We have an iOS app. Since July 15, 2022, our users met a kind of app crash due to an invalid memory fetch. The time is when Apple released iOS 16 beta officially. After Sep 12, crash count started to increase drastically. The time is Apple released iOS 16 officially. Crash backtrace can be seen as follows. Thread 14 Crashed: 0 libsystem_platform.dylib 0x00000001f8810930 _platform_memmove + 96 1 CoreGraphics 0x00000001adb64104 CGDataProviderCreateWithCopyOfData + 20 2 CoreGraphics 0x00000001adb4cdb4 CGBitmapContextCreateImage + 172 3 VisionKitCore 0x00000001ed813f10 -[VKCRemoveBackgroundResult _createCGImageFromBGRAPixelBuffer:cropRect:] + 348 4 VisionKitCore 0x00000001ed813cc0 -[VKCRemoveBackgroundResult createCGImage] + 156 5 VisionKitCore 0x00000001ed8ab6f8 __vk_cgImageRemoveBackgroundWithDownsizing_block_invoke + 64 6 VisionKitCore 0x00000001ed881474 __63-[VKCRemoveBackgroundRequestHandler performRequest:completion:]_block_invoke.5 + 436 7 MediaAnalysisServices 0x00000001eec58968 __92-[MADService performRequests:onPixelBuffer:withOrientation:andIdentifier:completionHandler:]_block_invoke.38 + 400 8 CoreFoundation 0x00000001abff0a14 __invoking___ + 148 9 CoreFoundation 0x00000001abf9cf2c -[NSInvocation invoke] + 428 10 Foundation 0x00000001a6464d38 __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ + 16 11 Foundation 0x00000001a64362fc -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 520 12 Foundation 0x00000001a6a10f44 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 188 13 libxpc.dylib 0x00000001f89053e4 _xpc_connection_reply_callout + 124 14 libxpc.dylib 0x00000001f88f8580 _xpc_connection_call_reply_async + 88 15 libdispatch.dylib 0x00000001b340205c _dispatch_client_callout3 + 20 16 libdispatch.dylib 0x00000001b341ff58 _dispatch_mach_msg_async_reply_invoke + 344 17 libdispatch.dylib 0x00000001b340956c _dispatch_lane_serial_drain + 376 18 libdispatch.dylib 0x00000001b340a214 _dispatch_lane_invoke + 436 19 libdispatch.dylib 0x00000001b3414e10 _dispatch_workloop_worker_thread + 652 20 libsystem_pthread.dylib 0x00000001f88a4df8 _pthread_wqthread + 288 21 libsystem_pthread.dylib 0x00000001f88a4b98 start_wqthread + 8 Last but not the least. The users who met this kind of app crash use iOS16+. We think this crash is related to iOS 16 SDK. We're appreciate that you can provide some clues how to fix this kind of crash.
14
2
7.0k
Oct ’23
Add code to the WWDC Session
I notice that some WWDC sessions have a code tab (in addition to Overview and Transcript) but this session 10176 does not. I tried what code I could see on the video but it's obviously not a complete project. It would help if the authors of the Session 10176 video could add the code to the session.
0
0
615
Oct ’23
Apple Vision Pro - Showing Error
var accessibilityComponent = AccessibilityComponent() accessibilityComponent.isAccessibilityElement = true accessibilityComponent.traits = [.button, .playsSound] accessibilityComponent.label = "Cloud" accessibilityComponent.value = "Grumpy" cloud.components[AccessibilityComponent.self] = accessibilityComponent // ... var isHappy: Bool { didSet { cloudEntities[id].accessibilityValue = isHappy ? "Happy" : "Grumpy" } }
0
0
960
Sep ’23
Trying RealityKit immersionStyle
I just grabbed the portal code made available for testing and ran into this error when trying to run in simulator Vision Pro Thread 1: Fatal error: SwiftUI Scene ImmersiveSpace requires a UISceneSessionRole of "UISceneSessionRoleImmersiveSpaceApplication" for key UIApplicationPreferredDefaultSceneSessionRole in the Application Scene Manifest.
6
2
4k
Sep ’23
compareDistance in Vision not working as expected
Hi, When using VNFeaturePrintObservation and then computing the distance using two images, the values that it returns varies heavily. When two identical images (same image file) is inputted into function (below) that I have used to compare the images, the distance does not return 0 while it is expected to, since they are identical images. Also, what is the upper limit of computeDistance? I am trying to find the percentage similarity between the two images. (Of course, this cannot be done unless the issue above is resolved). Code that I have used is below func featureprintObservationForImage(image: UIImage) -> VNFeaturePrintObservation? {     let requestHandler = VNImageRequestHandler(cgImage: image.cgImage!, options: [:])     let request = VNGenerateImageFeaturePrintRequest()     request.usesCPUOnly = true // Simulator Testing     do {       try requestHandler.perform([request])       return request.results?.first as? VNFeaturePrintObservation     } catch {       print("Vision Error: \(error)")       return nil     }   }   func compare(origImg: UIImage, drawnImg: UIImage) -> Float? {     let oImgObservation = featureprintObservationForImage(image: origImg)     let dImgObservation = featureprintObservationForImage(image: drawnImg)     if let oImgObservation = oImgObservation {       if let dImgObservation = dImgObservation {         var distance: Float = -1         do {           try oImgObservation.computeDistance(&distance, to: dImgObservation)         } catch {           fatalError("Failed to Compute Distance")         }         if distance == -1 {           return nil         } else {           return distance         }       } else {         print("Drawn Image Observation found Nil")       }     } else {       print("Original Image Observation found Nil")     }     return nil   } Thanks for all the help!
4
1
2.6k
Sep ’23
Extract subject of a picture programmatically
Hello, I'm doing a iOS app and I'm trying to find a way to extract programmatically a person from his identity picture (and to leave behind the background) I'm watching WWDC "Lift subjects from images in your app" video (a really cool feature) and i'm wondering if this feature would be possible programmatically, without the need of a human person interaction. Thank you.
2
0
1.6k
Sep ’23
Turn physical surface into touchscreen in VisionOS
In VisionOS is it possible to detect when a user is touching a physical surface in the real world and also to project 2D graphics on that surface? So imagine a windowless 2D app that is projected onto a surface, essentially turning a physical wall, table, etc. into a giant touchscreen? So kinda like this: https://appleinsider.com/articles/23/06/23/vision-pro-will-turn-any-surface-into-a-display-with-touch-control But I want every surface in the room to be touchable and be able to display 2D graphics on the face of that surface and not floating in space. So essentially turning every physical surface in the room into a UIView. Thanks!
1
0
1.2k
Sep ’23
Memory Leak caused by VNDocumentViewController
I'm using VNDocumentViewController to scan some documents which is working fine. But not infrequently, the app becomes slow after dismissing the VNDocumentViewController. There is no VNDocumentViewController instance allocated, but according to the allocations gathered by instruments, there is a ICDocCamViewController still living and using between 200 and 300 MB. I guess that ICDocCamViewController is an internal component of VNDocumentViewController. Are there any known issues? Unfortunately, I do not see any way to free ICDocCamViewController. 281.37 MB 93.1% 104708 start_wqthread 281.37 MB 93.1% 104708 _pthread_wqthread 256.04 MB 84.7% 42747 _dispatch_workloop_worker_thread 256.03 MB 84.7% 42564 _dispatch_lane_invoke 256.03 MB 84.7% 42564 _dispatch_lane_serial_drain 249.91 MB 82.7% 22258 _dispatch_client_callout 237.01 MB 78.4% 8562 _dispatch_call_block_and_release 236.50 MB 78.3% 3836 __77-[ICDocCamViewController saveCapturedImage:metaData:rects:completionHandler:]_block_invoke_3 236.50 MB 78.3% 3836 -[ICDocCamViewController cropAndFilterImage:rects:filterType:] 236.49 MB 78.3% 3678 +[ICDocCamImageFilters filteredImage:orientation:imageFilterType:] 236.49 MB 78.3% 3678 +[ICDocCamImageFilters colorDocument:orientation:] 236.47 MB 78.3% 3476 -[CIContext(createCGImage) createCGImage:fromRect:] 236.47 MB 78.3% 3476 -[CIContext(_createCGImageInternal) _createCGImage:fromRect:format:premultiplied:colorSpace:deferred:renderCallback:] 236.40 MB 78.2% 2096 -[CIContext(CIRenderDestination) startTaskToRender:fromRect:toDestination:atPoint:error:] 236.40 MB 78.2% 2096 -[CIContext(CIRenderDestination) _startTaskToRender:toDestination:forPrepareRender:forClear:error:] 236.40 MB 78.2% 2096 CI::RenderToBitmap::render(CI::Image*, CI::Context*) const 236.40 MB 78.2% 2096 CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*) 236.33 MB 78.2% 716 CI::tile_node_graph(CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) 236.33 MB 78.2% 716 CI::recursive_tile(CI::RenderTask*, CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) 236.26 MB 78.2% 212 invocation function for block in CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*) 236.26 MB 78.2% 212 CI::Context::render(CI::ProgramNode*, CGRect const&) 236.26 MB 78.2% 212 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.26 MB 78.2% 211 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.24 MB 78.2% 196 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.23 MB 78.2% 181 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.21 MB 78.2% 166 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.19 MB 78.2% 151 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 128 Bytes 0.0% 1 CI::MetalContext::render_root_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, void () block_pointer, void () block_pointer) 69.00 KB 0.0% 504 CI::gather_rois_for_program_graph(CI::Context*, char const*, CI::ProgramNode*, CGRect) 71.72 KB 0.0% 1380 CI::prepare_initial_graph(CI::Context*, char const*, CI::Image*, CI::RenderDestination const*, CGRect, CGColorSpace*, CI::PixelFormat, CI::swizzle_info, CI::Affine const&, bool, CI::TextureDescriptor*) 71.72 KB 0.0% 1380 CI::prepare_initial_graph(CI::Context*, char const*, CI::Image*, CI::RenderDestination const*, CGRect, CGColorSpace*, CI::PixelFormat, CI::swizzle_info, CI::Affine const&, bool, CI::TextureDescriptor*) 18.34 KB 0.0% 202 -[CIPaperWash outputImage]
1
0
1.1k
Sep ’23
failed to find newest available Simulator runtime
Env Intel Core i7 macOS :14.0 Xcode 15 Beta 8 simulator:visionOS 1.0 beta 3(21N5233e) simulator: ios 17.0.1 ,ios 17.0 beta 8 Step Xcode create a new Vision Demo, it can't build. [macosx] error: Failed to find newest available Simulator runtime Command RealityAssetsCompile failed with a nonzero exit code
Replies
1
Boosts
0
Views
1.2k
Activity
Dec ’23
Vision Pro Dev Kit question
Hi guys, has any individual develper received Vision Pro dev kit or is it just aimed at big companies? Basically I would like to start with one or 2 of my apps that I removed from the store already, just to get familiar with VisionOS platform and gain knowledge and skills on a small, but real project. After that I would like to use the Dev kit on another project. I work on a contract for mutlinational communication company on a pilot project in a small country and extending that project to VisionOS might be very interesting introduction of this new platform and could excite users utilizing their services. However I cannot quite reveal to Apple details for reasons of confidentiality. After completing that contract (or during that if I manage) I would like to start working on a great idea I do have for Vision Pro (as many of you do). Is it worth applying for Dev kit as an individual dev? I have read some posts, that guys were rejected. Is is better to start in simulator and just wait for actual hardware to show up in App Store? I would prefer to just get the device, rather than start working with the device that I may need to return in the middle of unfinished project. Any info on when pre-orders might be possible? Any idea what Mac specs are for developing for VisionOS - escpecially for 3D scenes. Just got Macbook Pro M3 Max with 96GB RAM, I'm thinknig if I should have maxed out the config. Anybody using that config with Vision Pro Dev kit? Thanks.
Replies
0
Boosts
0
Views
1.5k
Activity
Dec ’23
IP Camera support SDK for iOS Devices
I was looking for IP camera which is not very expensive. The key point is I should be able to convert its frames to CMSampleBuffer I would like to use images to make some basic analysis using Vision. So far I could not find any IP camera manufacturer supports SDK for Swift and iOS for this kind of study.
Replies
0
Boosts
0
Views
661
Activity
Nov ’23
DataScannerViewController could not get torch on when scanning.
I use DataScannerViewController to scan barcode and text recognize, and then get the AVCaptureDevice to use torch on/off, but DataScannerViewController will stop scanning. DataScannerViewController has no related API to get AVCaptureDevice to use torch. Expected: Could use AVCaptureDevice to turn on/off torch, at the same time DataScannerViewController could scan.
Replies
0
Boosts
0
Views
744
Activity
Nov ’23
How to use vision in visionOS?
In visionOS, how can I use vision in machine learning to recognize hand gestures? After all, currently visionOS does not provide any image frame data.
Replies
1
Boosts
1
Views
982
Activity
Nov ’23
Delegate methods of ImageAnalysisInteractionDelegate don't fire
I have a live text implementation on the following LiveTextImageView. However, after the view loads and the analyze code is run, none of the delegate methods fire when I interact with the Live View. Selecting text does not fire the textSelectionDidChange method, nor does highlightSelectedItemsDidChange fire when the live text button in the bottom right is pressed. I tried a few different implementations, including an approach where the delegate was defined on a separate class. I am running this on a iPhone 12 Pro I recently updated to 17.0.3. My goal is to be able to provide additional options to the user beyond the default live-text overlay options, after identifying when they have finished selecting text. // // LiveTextImageView.swift // import UIKit import SwiftUI import VisionKit class ImageAnalyzerWrapper { static let shared = ImageAnalyzer() private init() { } } struct LiveTextImageViewRepresentable: UIViewRepresentable { var image: UIImage func makeUIView(context: Context) -> LiveTextImageView { return LiveTextImageView(image: image) } func updateUIView(_ uiView: LiveTextImageView, context: Context) { } } class LiveTextImageView: UIImageView, ImageAnalysisInteractionDelegate, UIGestureRecognizerDelegate { var capturedSelectedText: String? let analyzer = ImageAnalyzerWrapper.shared let interaction = ImageAnalysisInteraction() init(image: UIImage) { super.init(frame: .zero) self.image = image let photoWrapper = PhotoWrapper(rawPhoto: image) let resizedPhoto = photoWrapper.viewportWidthCroppedPhoto(padding: 40) self.image = resizedPhoto self.contentMode = .scaleAspectFit self.addInteraction(interaction) interaction.preferredInteractionTypes = [] interaction.analysis = nil analyzeImage() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func analyzeImage() { if let image = self.image { Task { let configuration = ImageAnalyzer.Configuration([.text]) do { let analysis = try await analyzer.analyze(image, configuration: configuration) self.addInteraction(interaction) interaction.delegate = self interaction.analysis = analysis interaction.preferredInteractionTypes = .textSelection } catch { print("Error in live image handling") } } } } func interaction( _ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) async { print("Highlighted items changed") } func interaction(_ interaction: ImageAnalysisInteraction, shouldBeginAt point: CGPoint, for interactionType: ImageAnalysisInteraction.InteractionTypes) async -> Bool { return interaction.hasInteractiveItem(at: point) || interaction.hasActiveTextSelection } func textSelectionDidChange(_ interaction: ImageAnalysisInteraction) async { print("Changed!") if #available(iOS 17.0, *) { capturedSelectedText = interaction.text print(capturedSelectedText ?? "") } } }
Replies
0
Boosts
0
Views
1k
Activity
Oct ’23
Error in XCODE VISION OS APP
Eroor
Replies
0
Boosts
0
Views
997
Activity
Oct ’23
Runtime crash on iOS16 when iOS17 framework is mentioned
Hi Everyone, I'm having a strange crash on App launch with iOS16 when I have a reference to an iOS17 only framework in my code. Even if I wrap the code in #available, I still get the crash on launch; and the code isn't even called yet... just the existence of it causes the crash. Pretty strange I thought? The framework is VisionKit, and the code that causes the crash is if #available(iOS 17, *) { // .imageSubject is iOS17 only - but this causes // a crash on launch in iOS16 even with the #available check interaction.preferredInteractionTypes = .imageSubject } The crash is: Referenced from: <91ED5216-D66C-3649-91DA-B31C0B55DDA1> /private/var/containers/Bundle/Application/78FD9C93-5657-4FF5-85E7-A44B60717870/XXXXXX.app/XXXXXX Expected in: <AF01C435-3C37-3C7C-84D9-9B5EA3A59F5C> /System/Library/Frameworks/VisionKit.framework/VisionKit Any thoughts anyone?? I know the .imageSubject is iOS17 only, but the #available should catch it - no? Any why does it crash immediatley on launch, when that code is not even called? Odd!
Replies
1
Boosts
1
Views
1.1k
Activity
Oct ’23
iOS app crashed on iOS 16
Hi team, We have an iOS app. Since July 15, 2022, our users met a kind of app crash due to an invalid memory fetch. The time is when Apple released iOS 16 beta officially. After Sep 12, crash count started to increase drastically. The time is Apple released iOS 16 officially. Crash backtrace can be seen as follows. Thread 14 Crashed: 0 libsystem_platform.dylib 0x00000001f8810930 _platform_memmove + 96 1 CoreGraphics 0x00000001adb64104 CGDataProviderCreateWithCopyOfData + 20 2 CoreGraphics 0x00000001adb4cdb4 CGBitmapContextCreateImage + 172 3 VisionKitCore 0x00000001ed813f10 -[VKCRemoveBackgroundResult _createCGImageFromBGRAPixelBuffer:cropRect:] + 348 4 VisionKitCore 0x00000001ed813cc0 -[VKCRemoveBackgroundResult createCGImage] + 156 5 VisionKitCore 0x00000001ed8ab6f8 __vk_cgImageRemoveBackgroundWithDownsizing_block_invoke + 64 6 VisionKitCore 0x00000001ed881474 __63-[VKCRemoveBackgroundRequestHandler performRequest:completion:]_block_invoke.5 + 436 7 MediaAnalysisServices 0x00000001eec58968 __92-[MADService performRequests:onPixelBuffer:withOrientation:andIdentifier:completionHandler:]_block_invoke.38 + 400 8 CoreFoundation 0x00000001abff0a14 __invoking___ + 148 9 CoreFoundation 0x00000001abf9cf2c -[NSInvocation invoke] + 428 10 Foundation 0x00000001a6464d38 __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ + 16 11 Foundation 0x00000001a64362fc -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 520 12 Foundation 0x00000001a6a10f44 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 188 13 libxpc.dylib 0x00000001f89053e4 _xpc_connection_reply_callout + 124 14 libxpc.dylib 0x00000001f88f8580 _xpc_connection_call_reply_async + 88 15 libdispatch.dylib 0x00000001b340205c _dispatch_client_callout3 + 20 16 libdispatch.dylib 0x00000001b341ff58 _dispatch_mach_msg_async_reply_invoke + 344 17 libdispatch.dylib 0x00000001b340956c _dispatch_lane_serial_drain + 376 18 libdispatch.dylib 0x00000001b340a214 _dispatch_lane_invoke + 436 19 libdispatch.dylib 0x00000001b3414e10 _dispatch_workloop_worker_thread + 652 20 libsystem_pthread.dylib 0x00000001f88a4df8 _pthread_wqthread + 288 21 libsystem_pthread.dylib 0x00000001f88a4b98 start_wqthread + 8 Last but not the least. The users who met this kind of app crash use iOS16+. We think this crash is related to iOS 16 SDK. We're appreciate that you can provide some clues how to fix this kind of crash.
Replies
14
Boosts
2
Views
7.0k
Activity
Oct ’23
Add code to the WWDC Session
I notice that some WWDC sessions have a code tab (in addition to Overview and Transcript) but this session 10176 does not. I tried what code I could see on the video but it's obviously not a complete project. It would help if the authors of the Session 10176 video could add the code to the session.
Replies
0
Boosts
0
Views
615
Activity
Oct ’23
Apple Vision Pro - Showing Error
var accessibilityComponent = AccessibilityComponent() accessibilityComponent.isAccessibilityElement = true accessibilityComponent.traits = [.button, .playsSound] accessibilityComponent.label = "Cloud" accessibilityComponent.value = "Grumpy" cloud.components[AccessibilityComponent.self] = accessibilityComponent // ... var isHappy: Bool { didSet { cloudEntities[id].accessibilityValue = isHappy ? "Happy" : "Grumpy" } }
Replies
0
Boosts
0
Views
960
Activity
Sep ’23
Trying RealityKit immersionStyle
I just grabbed the portal code made available for testing and ran into this error when trying to run in simulator Vision Pro Thread 1: Fatal error: SwiftUI Scene ImmersiveSpace requires a UISceneSessionRole of "UISceneSessionRoleImmersiveSpaceApplication" for key UIApplicationPreferredDefaultSceneSessionRole in the Application Scene Manifest.
Replies
6
Boosts
2
Views
4k
Activity
Sep ’23
On the issue of VNDocumentCameraViewController automatic scanning
Using VNDocumentCameraViewController, if the document is automatically scanned, it cannot be obtained in the func documentCameraViewController (_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {}. If manual photography is used, data can be obtained May I ask how to solve it?
Replies
0
Boosts
0
Views
848
Activity
Sep ’23
How to scan credit card using camera swift
I trying to scan credit card but i am getting some issue with printed( Pressed ) number on card and some dark background with dark card numbers as well not scanning. Please help me to smooth scan for every cards. Thanks.
Replies
0
Boosts
0
Views
1.2k
Activity
Sep ’23
DataScannerViewController and torch
Hi, do you know if it's possible to handle the flashlight inside DataScannerViewController? I tried with AVCaptureDevice.DiscoverySession, but clearly when torchmode is on DataScannerViewController freeze... Thanks Luca
Replies
7
Boosts
2
Views
3.2k
Activity
Sep ’23
compareDistance in Vision not working as expected
Hi, When using VNFeaturePrintObservation and then computing the distance using two images, the values that it returns varies heavily. When two identical images (same image file) is inputted into function (below) that I have used to compare the images, the distance does not return 0 while it is expected to, since they are identical images. Also, what is the upper limit of computeDistance? I am trying to find the percentage similarity between the two images. (Of course, this cannot be done unless the issue above is resolved). Code that I have used is below func featureprintObservationForImage(image: UIImage) -> VNFeaturePrintObservation? {     let requestHandler = VNImageRequestHandler(cgImage: image.cgImage!, options: [:])     let request = VNGenerateImageFeaturePrintRequest()     request.usesCPUOnly = true // Simulator Testing     do {       try requestHandler.perform([request])       return request.results?.first as? VNFeaturePrintObservation     } catch {       print("Vision Error: \(error)")       return nil     }   }   func compare(origImg: UIImage, drawnImg: UIImage) -> Float? {     let oImgObservation = featureprintObservationForImage(image: origImg)     let dImgObservation = featureprintObservationForImage(image: drawnImg)     if let oImgObservation = oImgObservation {       if let dImgObservation = dImgObservation {         var distance: Float = -1         do {           try oImgObservation.computeDistance(&distance, to: dImgObservation)         } catch {           fatalError("Failed to Compute Distance")         }         if distance == -1 {           return nil         } else {           return distance         }       } else {         print("Drawn Image Observation found Nil")       }     } else {       print("Original Image Observation found Nil")     }     return nil   } Thanks for all the help!
Replies
4
Boosts
1
Views
2.6k
Activity
Sep ’23
Extract subject of a picture programmatically
Hello, I'm doing a iOS app and I'm trying to find a way to extract programmatically a person from his identity picture (and to leave behind the background) I'm watching WWDC "Lift subjects from images in your app" video (a really cool feature) and i'm wondering if this feature would be possible programmatically, without the need of a human person interaction. Thank you.
Replies
2
Boosts
0
Views
1.6k
Activity
Sep ’23
Turn physical surface into touchscreen in VisionOS
In VisionOS is it possible to detect when a user is touching a physical surface in the real world and also to project 2D graphics on that surface? So imagine a windowless 2D app that is projected onto a surface, essentially turning a physical wall, table, etc. into a giant touchscreen? So kinda like this: https://appleinsider.com/articles/23/06/23/vision-pro-will-turn-any-surface-into-a-display-with-touch-control But I want every surface in the room to be touchable and be able to display 2D graphics on the face of that surface and not floating in space. So essentially turning every physical surface in the room into a UIView. Thanks!
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’23
Memory Leak caused by VNDocumentViewController
I'm using VNDocumentViewController to scan some documents which is working fine. But not infrequently, the app becomes slow after dismissing the VNDocumentViewController. There is no VNDocumentViewController instance allocated, but according to the allocations gathered by instruments, there is a ICDocCamViewController still living and using between 200 and 300 MB. I guess that ICDocCamViewController is an internal component of VNDocumentViewController. Are there any known issues? Unfortunately, I do not see any way to free ICDocCamViewController. 281.37 MB 93.1% 104708 start_wqthread 281.37 MB 93.1% 104708 _pthread_wqthread 256.04 MB 84.7% 42747 _dispatch_workloop_worker_thread 256.03 MB 84.7% 42564 _dispatch_lane_invoke 256.03 MB 84.7% 42564 _dispatch_lane_serial_drain 249.91 MB 82.7% 22258 _dispatch_client_callout 237.01 MB 78.4% 8562 _dispatch_call_block_and_release 236.50 MB 78.3% 3836 __77-[ICDocCamViewController saveCapturedImage:metaData:rects:completionHandler:]_block_invoke_3 236.50 MB 78.3% 3836 -[ICDocCamViewController cropAndFilterImage:rects:filterType:] 236.49 MB 78.3% 3678 +[ICDocCamImageFilters filteredImage:orientation:imageFilterType:] 236.49 MB 78.3% 3678 +[ICDocCamImageFilters colorDocument:orientation:] 236.47 MB 78.3% 3476 -[CIContext(createCGImage) createCGImage:fromRect:] 236.47 MB 78.3% 3476 -[CIContext(_createCGImageInternal) _createCGImage:fromRect:format:premultiplied:colorSpace:deferred:renderCallback:] 236.40 MB 78.2% 2096 -[CIContext(CIRenderDestination) startTaskToRender:fromRect:toDestination:atPoint:error:] 236.40 MB 78.2% 2096 -[CIContext(CIRenderDestination) _startTaskToRender:toDestination:forPrepareRender:forClear:error:] 236.40 MB 78.2% 2096 CI::RenderToBitmap::render(CI::Image*, CI::Context*) const 236.40 MB 78.2% 2096 CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*) 236.33 MB 78.2% 716 CI::tile_node_graph(CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) 236.33 MB 78.2% 716 CI::recursive_tile(CI::RenderTask*, CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) 236.26 MB 78.2% 212 invocation function for block in CI::image_get_bitmap(CI::Context*, CI::Image*, CGRect, CGColorSpace*, CI::Bitmap*, CI::RenderDestination const*) 236.26 MB 78.2% 212 CI::Context::render(CI::ProgramNode*, CGRect const&) 236.26 MB 78.2% 212 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.26 MB 78.2% 211 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.24 MB 78.2% 196 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.23 MB 78.2% 181 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.21 MB 78.2% 166 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 236.19 MB 78.2% 151 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 17.02 KB 0.0% 14 CI::MetalTextureManager::create_intermediate(CI::IntermediateDescriptor const&, unsigned long long, CGRect const&, unsigned long, unsigned long, bool) 128 Bytes 0.0% 1 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) 128 Bytes 0.0% 1 CI::MetalContext::render_root_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, void () block_pointer, void () block_pointer) 69.00 KB 0.0% 504 CI::gather_rois_for_program_graph(CI::Context*, char const*, CI::ProgramNode*, CGRect) 71.72 KB 0.0% 1380 CI::prepare_initial_graph(CI::Context*, char const*, CI::Image*, CI::RenderDestination const*, CGRect, CGColorSpace*, CI::PixelFormat, CI::swizzle_info, CI::Affine const&, bool, CI::TextureDescriptor*) 71.72 KB 0.0% 1380 CI::prepare_initial_graph(CI::Context*, char const*, CI::Image*, CI::RenderDestination const*, CGRect, CGColorSpace*, CI::PixelFormat, CI::swizzle_info, CI::Affine const&, bool, CI::TextureDescriptor*) 18.34 KB 0.0% 202 -[CIPaperWash outputImage]
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’23