Post

Replies

Boosts

Views

Activity

URLSession download task fails with NSPOSIXErrorDomain error Code=1
I have a Push Notification Service Extension, which is processing notification payload to attach image, if imageUrl is key is present. I use this simple code to perform the download: let downloadTask = URLSession.shared.downloadTask(with: urlRequest) { [weak self] tempURL, response, error in /// parse results... } Notification payload contains "mutable-content" : 1 inside aps. It's entirely randomly will it work or not. When it doesn't work, I get this error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={NSErrorFailingURLStringKey=https://w7.pngwing.com/pngs/1005/607/png-transparent-african-elephant-animal-elephant-thumbnail.png, NSErrorFailingURLKey=https://w7.pngwing.com/pngs/1005/607/png-transparent-african-elephant-animal-elephant-thumbnail.png, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDownloadTask <4A847242-2314-4125-99E4-A424CF4B4B7C>.<7>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <4A847242-2314-4125-99E4-A424CF4B4B7C>.<7>} I have no idea what Apple's internal code throws this error, what could possibly go wrong here. This is happening for a while now, I just re-tested on iOS 17.5.1 on 14 Pro. App is compiled using Xcode 15.4 and Swift 5.10, latest SDK. Not sure is it relevant but main iOS app has DataProtection capability set to Complete.
9
0
188
2w
Include/exclude .xcassets file per chosen build configuration
I have a single iOS target project which is used with dozen or so .xcconfig files to build multiple different apps. xcconfig file allows us to customise app icon, launch storyboard, API endpoints, bundle identifiers etc. However, we also need to customise the .xcassets per configuration which I don't know how to do. I have Brandcolors.xcassets which needs to be different for each configuration. I can do this manually by changing target membership of certain files in the project based on active xcconfig/scheme. Is there some (sane) way to do this automatically other than manually adjusting pbxproj in the run-script build phase?
0
0
363
Jan ’23
UIFlowLayoutRow crash
I am getting intermittent crash in _UIFlowLayoutRow layoutRow. I can't figure out what is causing this to happen, it seems like a normal layout stack. In vast majority of cases it works so this must be some race condition which I can't catch. Thread 0#0 (null) in -[_UIFlowLayoutRow layoutRow] () #1 (null) in -[_UIFlowLayoutRow layoutRow] () #2 (null) in -[_UIFlowLayoutSection computeLayoutInRect:forSection:invalidating:invalidationContext:] () #3 (null) in __76-[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]_block_invoke () #4 (null) in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ () #5 (null) in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] () #6 (null) in -[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:] () #7 (null) in -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] () #8 (null) in -[UICollectionViewFlowLayout collectionViewContentSize] () #9 (null) in -[UICollectionViewFlowLayout invalidateLayoutWithContext:] () #10 (null) in -[UICollectionViewLayout _invalidateLayoutUsingContext:] () #11 (null) in -[UICollectionView setBounds:] () #12 (null) in -[UIView(Geometry) _applyISEngineLayoutValuesToBoundsOnly:] () #13 (null) in -[UIView(Geometry) _resizeWithOldSuperviewSize:] () #14 (null) in -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] () #15 (null) in __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke () #16 (null) in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ () #17 (null) in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] () #18 (null) in -[UIView(Geometry) resizeSubviewsWithOldSize:] () #19 (null) in -[UIView(AdditionalLayoutSupport) _is_layout] () #20 (null) in -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] () #21 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #22 (null) in CA::Layer::layout_if_needed(CA::Transaction*) () #23 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #24 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) () #25 (null) in CA::Transaction::commit() () #26 (null) in CA::Transaction::flush_as_runloop_observer(bool) () #27 (null) in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ () #28 (null) in __CFRunLoopDoObservers () #29 (null) in __CFRunLoopRun () #30 (null) in CFRunLoopRunSpecific () #31 (null) in GSEventRunModal () #32 (null) in -[UIApplication _run] () #33 (null) in UIApplicationMain ()
1
0
302
Apr ’22
UIFlowLayoutRow crash
I am getting intermittent crash in _UIFlowLayoutRow layoutRow. I can't figure out what is causing this to happen, it seems like a normal layout stack. In vast majority of cases it works so this must be some race condition which I can't catch. Thread 0#0 (null) in -[_UIFlowLayoutRow layoutRow] () #1 (null) in -[_UIFlowLayoutRow layoutRow] () #2 (null) in -[_UIFlowLayoutSection computeLayoutInRect:forSection:invalidating:invalidationContext:] () #3 (null) in __76-[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:]_block_invoke () #4 (null) in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ () #5 (null) in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] () #6 (null) in -[UICollectionViewFlowLayout _updateItemsLayoutForRect:allowsPartialUpdate:] () #7 (null) in -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] () #8 (null) in -[UICollectionViewFlowLayout collectionViewContentSize] () #9 (null) in -[UICollectionViewFlowLayout invalidateLayoutWithContext:] () #10 (null) in -[UICollectionViewLayout _invalidateLayoutUsingContext:] () #11 (null) in -[UICollectionView setBounds:] () #12 (null) in -[UIView(Geometry) _applyISEngineLayoutValuesToBoundsOnly:] () #13 (null) in -[UIView(Geometry) _resizeWithOldSuperviewSize:] () #14 (null) in -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] () #15 (null) in __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke () #16 (null) in __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ () #17 (null) in -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] () #18 (null) in -[UIView(Geometry) resizeSubviewsWithOldSize:] () #19 (null) in -[UIView(AdditionalLayoutSupport) _is_layout] () #20 (null) in -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] () #21 (null) in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] () #22 (null) in CA::Layer::layout_if_needed(CA::Transaction*) () #23 (null) in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #24 (null) in CA::Context::commit_transaction(CA::Transaction*, double, double*) () #25 (null) in CA::Transaction::commit() () #26 (null) in CA::Transaction::flush_as_runloop_observer(bool) () #27 (null) in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ () #28 (null) in __CFRunLoopDoObservers () #29 (null) in __CFRunLoopRun () #30 (null) in CFRunLoopRunSpecific () #31 (null) in GSEventRunModal () #32 (null) in -[UIApplication _run] () #33 (null) in UIApplicationMain ()
1
0
538
Apr ’22
How to verify that Apple's CDN has picked up newer version of the apple-app-site-association file?
We updated the file ~2 days ago and the feature we are working on seemingly does not work - web links never open in the app, always end up at the browser. I set up new test site, added the file there and linked it up with the app. Tapping the link opens in the app. So my conclusion is that Apple's CDN is not updated. But how I can verify that?
5
1
13k
Jan ’22
How to attach to a running process on Apple Watch?
I connect my iPhone to Mac. I use Debug / Attach to Process and then pick the Watch Extension process running on my paired Watch Series 4. Xcode 11.7, watchOS is 6.2.8, iOS is 13.7 The error dialog I get after a while is: attach failed (Not allowed to attach in process. Look in the console messages (Console.app) near the debugserver entries when the attached failed.. But there's nothing useful I can find. Where in Console.app should I look for those entries?
1
0
1.4k
Sep ’20