Post

Replies

Boosts

Views

Activity

XCode 13 beta fails to load Metal CoreImage Kernel
This is a weird XCode 13 beta bug (including beta 5). Metal Core Image kernels fail to load from the library giving error 2021-08-26 12:05:23.806226+0400 MetalFilter[23183:1751438] [api] +[CIKernel kernelWithFunctionName:fromMetalLibraryData:options:error:] Cannot initialize kernel with given library data. [ERROR] Failed to create CIColorKernel: Error Domain=CIKernel Code=6 "(null)" UserInfo={CINonLocalizedDescriptionKey=Cannot initialize kernel with given library data.} But there is no such error with XCode 12.5. The kernel loads fine. Only on XCode 13 beta there is an error.
2
0
1.6k
Aug ’21
iOS 16 Autorotation strange issue
I am seeing a strange issue with autorotation on iOS 16 that is not seen in other iOS versions. And worse, the issue is NOT seen if I connect device to XCode and debug. It is ONLY seen when I directly launch the app on device once it is installed, and that's the reason I am unable to identify any fix. So here is the summary of the issue. I disable autorotation in the app till the camera session starts running. Once camera session starts running, I fire a notification to force autorotation of device to current orientation. var disableAutoRotation: Bool { if !cameraSessionRunning { return true } return false } override var supportedInterfaceOrientations: UIInterfaceOrientationMask { var orientations:UIInterfaceOrientationMask = .landscapeRight if !self.disableAutoRotation { orientations = .all } return orientations } func cameraSessionStartedRunning(_ session:AVCaptureSession?) { DispatchQueue.main.asyncAfter(deadline: .now(), execute: { /* * HELP::: This code does something only when debug directly from XCode, * not when directly launching the app on device!!!! */ cameraSessionRunning = true if #available(iOS 16.0, *) { UIView.performWithoutAnimation { self.setNeedsUpdateOfSupportedInterfaceOrientations() } } else { // Fallback on earlier versions UIViewController.attemptRotationToDeviceOrientation() } self.layoutInterfaceForOrientation(self.windowOrientation) }) }
Topic: UI Frameworks SubTopic: UIKit Tags:
4
2
2.6k
Sep ’22
iOS 16.1 CDPurgeableResultCache logs
I keep getting repeated logs on iOS 16.1: [client] 114 CDPurgeableResultCache _recentPurgeableTotals no result for /private/var/wireless/baseband_data, setting to zero The logs fill the console and it's difficult to find useful logs that are there in my code. What can be done to disable these logs?
0
3
1.5k
Nov ’22
ShareSheet errors on console when presenting UIActivityViewController
I see these errors when presenting UIActivityViewController with a video file. [ShareSheet] Failed to request default share mode for fileURL:file:///var/mobile/Containers/Data/Application/B0EB55D3-4BF1-430A-92D8-2231AFFD9499/Documents/IMG-0155.mov error:Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=1538, _LSFunction=runEvaluator} I don't understand if I am doing something wrong and what the error means. The share sheet shows anyways.
Topic: UI Frameworks SubTopic: UIKit Tags:
5
3
2.3k
Aug ’23
Implementing Tone Curves using Metal/Core Image
I am trying to develop tone curves filter using Metal or Core Image as I find CIToneCurve filter is having limitations (number of points are atmost 5, spline curve it is using is not documented, and sometimes output is a black image even with 4 points). Moreover it's not straightforward to have separate R,G,B curves independently. I decided to explore other libraries that implement tone curve and the only one that I know is GPUImage (few others borrow code from the same library). But the source code is too cryptic to understand and I have [doubts] about the manner in which it is generating look up texture (https://stackoverflow.com/questions/70516363/gpuimage-tone-curve-rgbcomposite-filter). Can someone explain how to correctly implement R,G,B, and RGB composite curves filter like in Mac Photos App?
1
1
1.9k
May ’22
Autolayout warning "NSLayoutConstraint is being configured with a constant that exceeds internal limits"
I have a subclass of UIScrollView called MyScrollView. There is a subview called contentViewinside MyScrollView. The width constraint is set to be the contentSize of MyScrollView. private func setupSubviews() { contentView = ContentView() contentView.backgroundColor = UIColor.blue contentView.translatesAutoresizingMaskIntoConstraints = false contentView.isUserInteractionEnabled = true self.addSubview(contentView) contentView.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true contentView.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true contentView.topAnchor.constraint(equalTo: self.topAnchor).isActive = true contentView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true // create contentView's Width and Height constraints cvWidthConstraint = contentView.widthAnchor.constraint(equalToConstant: 0.0) cvHeightConstraint = contentView.heightAnchor.constraint(equalToConstant: 0.0) // activate them cvWidthConstraint.isActive = true cvHeightConstraint.isActive = true cvWidthConstraint.constant = myWidthConstant //<--- problem here if myWidthConstant is very high, such as 512000 cvHeightConstraint.constant = frame.height contentView.layoutIfNeeded() } The problem is if I set cvWidthConstraint.constant to a very high value such as 521000, I get a warning: This NSLayoutConstraint is being configured with a constant that exceeds internal limits. A smaller value will be substituted, but this problem should be fixed. Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future. I wonder how does one set UIScrollView content size to be very high values?
1
0
1.2k
Mar ’22
AVAudioEngine exception - required condition is false format.sampleRate == hwFormat.sampleRate
I see in Crashlytics few users are getting this exception when connecting the inputNode to mainMixerNode in AVAudioEngine: Fatal Exception: com.apple.coreaudio.avfaudio required condition is false: format.sampleRate == hwFormat.sampleRate Here is my code: self.engine = AVAudioEngine() let format = engine.inputNode.inputFormat(forBus: 0) //main mixer node is connected to output node by default engine.connect(self.engine.inputNode, to: self.engine.mainMixerNode, format: format) Just want to understand how can this error occur and what is the right fix?
2
1
2.9k
Aug ’22
Urgent: XCode 13 unable to delete lines of code
I deleted Derived data of project and after that I can't remove any line of code in the project. The moment I delete any character in function, XCode 13 is duplicating that line as seen in the below image. And I can't delete even a comment. The code doesn't even build now. What do I do? A big chunk of commented code I tried to delete, it deletes but then shows that deleted code again upwards in another function.
1
0
1.6k
Sep ’21
'User Assigned Device Name' in XCode Capabilities list
I got approval for User Assigned Device Name but now am stuck how to import this capability in XCode? I successfully updated my AppId in membership portal to reflect this permission, but I can't find anything in XCode to import this. I opened Editor -&gt; Add Capability but there is no option to add User Assigned Device Name in the list! User Assigned Device Name
17
1
6.8k
Dec ’22
Unable to build Core Image kernels in XCode 16
My app is suddenly broken when I build it with XCode 16. It seems Core Image kernels compilation is broken in XCode 16. Answers on StackOverflow seem to suggest we need to use a downgraded version of Core Image framework as a workaround, but I am not sure if there is a better solution out there. FYI, I am using [[ stitchable ]] kernels and I see projects having stitchable are the ones showing issue. air-lld: error: symbol(s) not found for target 'air64_v26-apple-ios17.0.0' metal: error: air-lld command failed with exit code 1 (use -v to see invocation) Showing Recent Messages /Users/Username/Camera4S-Swift/air-lld:1:1: ignoring file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreImage.framework/CoreImage.metallib', file AIR version (2.7) is bigger than the one of the target being linked (2.6)
1
2
570
Sep ’24
High CPU usage with CoreImage vs Metal
I am processing CVPixelBuffers received from camera using both Metal and CoreImage, and comparing the performance. The only processing that is done is taking a source pixel buffer and applying crop & affine transforms, and saving the result to another pixel buffer. What I do notice is CPU usage is as high a 50% when using CoreImage and only 20% when using Metal. The profiler shows most of the time spent is in CIContext render: let cropRect = AVMakeRect(aspectRatio: CGSize(width: dstWidth, height: dstHeight), insideRect: srcImage.extent) var dstImage = srcImage.cropped(to: cropRect) let translationTransform = CGAffineTransform(translationX: -cropRect.minX, y: -cropRect.minY) var transform = CGAffineTransform.identity transform = transform.concatenating(CGAffineTransform(translationX: -(dstImage.extent.origin.x + dstImage.extent.width/2), y: -(dstImage.extent.origin.y + dstImage.extent.height/2))) transform = transform.concatenating(translationTransform) transform = transform.concatenating(CGAffineTransform(translationX: (dstImage.extent.origin.x + dstImage.extent.width/2), y: (dstImage.extent.origin.y + dstImage.extent.height/2))) dstImage = dstImage.transformed(by: translationTransform) let scale = max(dstWidth/(dstImage.extent.width), CGFloat(dstHeight/dstImage.extent.height)) let scalingTransform = CGAffineTransform(scaleX: scale, y: scale) transform = CGAffineTransform.identity transform = transform.concatenating(scalingTransform) dstImage = dstImage.transformed(by: transform) if flipVertical { dstImage = dstImage.transformed(by: CGAffineTransform(scaleX: 1, y: -1)) dstImage = dstImage.transformed(by: CGAffineTransform(translationX: 0, y: dstImage.extent.size.height)) } if flipHorizontal { dstImage = dstImage.transformed(by: CGAffineTransform(scaleX: -1, y: 1)) dstImage = dstImage.transformed(by: CGAffineTransform(translationX: dstImage.extent.size.width, y: 0)) } var dstBounds = CGRect.zero dstBounds.size = dstImage.extent.size _ciContext.render(dstImage, to: dstPixelBuffer!, bounds: dstImage.extent, colorSpace: srcImage.colorSpace ) Here is how CIContext was created: _ciContext = CIContext(mtlDevice: MTLCreateSystemDefaultDevice()!, options: [CIContextOption.cacheIntermediates: false]) I want to know if I am doing anything wrong and what could be done to lower CPU usage in CoreImage?
4
1
2.0k
Oct ’23
StoreKit2 Errors on iOS 17
I noticed on iOS 17 that calling AppTransaction.shared fails with following errors. Here is the code: let result: VerificationResult<AppTransaction> = try await AppTransaction.shared NSLog("Result \(result)") It does not hit the NSLog statement and instead throws the following error logs. Error getting app transaction: Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo={NSUnderlyingError=0x281815050 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt?REDACTED, AMSStatusCode=401, AMSServerPayload={ errorCode = 500317; }, NSLocalizedFailureReason=The response has an invalid status code}}} Received error that does not have a corresponding StoreKit Error: Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo= {NSLocalizedDescription=Invalid Status Code, AMSURL=https://mzstorekit- sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt?REDACTED, AMSStatusCode=401, AMSServerPayload={ errorCode = 500317; }, NSLocalizedFailureReason=The response has an invalid status code} Received error that does not have a corresponding StoreKit Error: Error Domain=ASDErrorDomain Code=500 "(null)" UserInfo=.{NSUnderlyingError=0x281815050 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://mzstorekit-sb.itunes.apple.com/inApps/v1/receipts/createAppReceipt?REDACTED, AMSStatusCode=401, AMSServerPayload={ errorCode = 500317; }, NSLocalizedFailureReason=The response has an invalid status code}}}
2
1
1.1k
Oct ’23
SwiftUI view body invoked in infinite loop
I am observing infinite loop of view creation, deletion, and recreation when I move my app to background and bring back to foreground. I am clueless what is causing this repeated invocation of view body, so I tried Self._printChanges() inside the view body . But all I get is the following in console. ChildView: @ self , _dismiss changed. //<--- This is the problematic view ParentView: unchanged. //<--- This is parent view The issue has also been reported on Apple developer forums but no solution found. What are other options to debug this issue?
1
1
531
Jul ’24