Post

Replies

Boosts

Views

Activity

iOS 18.2 crash on CGImageDestinationFinalize
My app reports a lot of crashes from 18.2 users. I have been able to narrow down the issue to this line of code: CGImageDestinationFinalize(imageDestination) The error is Thread 93: EXC_BAD_ACCESS (code=1, address=0x146318000) But I have no idea why this suddently started to crash. Here is the code of the function: private func estimateSizeUsingThumbnailMethod(fromImageURL url: URL, imageSettings: ImageSettings) -> (Int, Int) { let sourceOptions = [kCGImageSourceShouldCache: false] as CFDictionary guard let source = CGImageSourceCreateWithURL(url as CFURL, sourceOptions), let imageProperties = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any], let imageWidth = imageProperties[kCGImagePropertyPixelWidth] as? CGFloat, let imageHeight = imageProperties[kCGImagePropertyPixelHeight] as? CGFloat else { return (0, 0) } let maxImageSize = max(imageWidth, imageHeight) let thumbMaxSize = min(2400, maxImageSize) // Use original size if possible, but not if larger than 2400, in this case we'll extrapolate from thumbnail let downsampleOptions = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: thumbMaxSize as CFNumber, ] as CFDictionary guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else { DLog("CGImage thumb creation error") return (0, 0) } let data = NSMutableData() guard let imageDestination = CGImageDestinationCreateWithData(data, UTType.jpeg.identifier as CFString, 1, nil) else { DLog("CGImage destination creation error") return (0, 0) } let destinationProperties = [ kCGImageDestinationLossyCompressionQuality: imageSettings.quality.compressionRatio() // Set jpeg compression ratio ] as CFDictionary CGImageDestinationAddImage(imageDestination, cgImage, destinationProperties) CGImageDestinationFinalize(imageDestination) // <----- CRASHES HERE with EXC_BAD_ACCESS ... } So far, I'm stuck. Any idea that could help would be greatly appreciated, as I'm scared that this crash will propagate on the official release of 18.2
1
0
158
1w
CMAltimeter absolute altitude delivery BROKEN (super slow & inaccurate)
Reproducible on iOS 17.4.1 (maybe before) & iOS 17.5. Maybe iOS 17.4 but I can't test it. NSMotionUsageDescription is correctly set (and has always been) Fitness activity & motion authorization are correctly enabled The delivery for absolute altitude changes became super slow, and might be inaccurate. The only value I get is exactly the same as the GPS altitude. The accelerometer data does not seem to be taken into account anymore. This critical bug has broken two apps of mine. How could I quickly solve this? Thank you! PS: code is dead simple let operationQueue = OperationQueue() self.altimeter.startAbsoluteAltitudeUpdates(to: operationQueue) { [weak self] (data, error) in guard let self = self else { return } guard let data else { return } DispatchQueue.main.async { // Use this value for display self.altitude = Measurement(value: data.altitude, unit: UnitLength.meters) /* DEBUG VIEW */ self.updateDebugView(with: data.altitude) } }
2
0
643
May ’24
One-way file transfer: when to cleanup the source file?
I'm using Watch Connectivity to transfer files from the Watch to its paired iOS device. File transfer is successful in my first tests, but obviously I need to erase the source file when it is - successfully - sent. When should I do that? just after initiating the file transfer, using transferFile(file: NSURL, metadata: [String : AnyObject]) when getting the returned WCSessionFileTransfer? when getting the callback func session(_ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer ? --> but will the callback always be called, even if the transfer finishes while the app is in background? some other time? NB: I'd really want to avoid implementing a custom 'ack' system, thus not using any user info/application context transfer.
1
0
639
Aug ’23
StoreKit2: Transaction.currentEntitlements returns expired subscriptions (Testing locally with shortened sub periods)
Hi, title says it all: I have Transaction.currentEntitlements returning expired subscriptions (testing both transaction expirationDate & RenewalState). Environment: local via .storekit file. Subscription duration is shortened for testing. Could it be the issue? The sub duration is normally 1 year. The documentation says it should only returns active subscription (RenewalState.subscribed) or in grace period (RenewalState.inGracePeriod).
2
1
1.7k
May ’23
iOS 16.4: UISearchTextField.resignFirstResponder() --> app hangs, CPU 100%
Since iOS 16.4, my apps hangs when I dismiss the keyboard in viewWillDisappear(). Here is my code: override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) DLog("will disappear <<<<<") dismissKeyboard() } fileprivate func dismissKeyboard() { self.filenameSearchTextField.resignFirstResponder() } App hangs, CPU is 100%, memory usage is increasing. The hangs happen on the resignFirstResponder() call. What's going on here?
1
0
559
Mar ’23
Re-purchasing an expired auto-renewable subscription
Hi,In the following scenario :User purchases an auto-renewable subscription (ex: 1 month) for a premium accessUser cancels the subscription but still has premium access until it expiresWhen expired, the user purchases the subscription again--&gt; I receive a .restored transaction state in the paymentQueue updated transactions (sandbox environment)I was expecting a .purchased instead.The problem is that in that case, there is no call to paymentQueueRestoreCompletedTransactionsFinished(_: SKPaymentQueue)How should I handle this case properly?Thank you!
1
0
1.3k
Jun ’20
How to sync NSPersistentDocument with iOS devices
Dears,I'm currently finishing developing a macOS application that uses NSPersistentDocument to store the user's data.The feedbacks from testers being positive, I'm thinking of developing an iOS version of the application for the user to be able to consult/manage his data on his iOS/iPadOS devices.The 'problem' is that I use NSPersistentDocument and I could not find any lead on how to do this.iCloud synchronization seems to have changed so much over the year, I cannot manage to find up-to-date recommendations for the 2020 way of achieving this - quite popular - functionality.Any recommendation on how to do this the modern way ?Thanks!
0
0
841
Mar ’20