Unfortunately, I also realised that directoryURL has no functionality. The user should be able to load a file from one directory and save the edited file in another directory. I would like to set the two paths as directoryURL depending on the load or save function. This way the user would not have to keep changing directories if he wants to save the edited file in a different directory than the original file. If the directory keeps changing to the last one used, the user will quickly become annoyed.
Maybe someone else has found a solution?
Post
Replies
Boosts
Views
Activity
I can live very well with the solution that I first connect the iPhone and then start Xcode. Then the data is transferred via USB. As long as it stays that way, I'm happy.
It works again. I was now able to submit yesterday's app for review without creating a new build.
Could someone here please write what the solution was? Do we just have to wait longer?
We also got an email today with the subject "Your submission was accepted." and the message "Congratulations! Your submission was accepted for release on the App Store."
But the second email with the subject "Ready for Sale", which actually comes immediately afterwards, has not arrived.
Now 5 hours have passed and the status of the app is still "In Review".
It would be very nice if someone who had this situation before would write their experiences and the solution here.
The problem seems to have been fixed in iOS 17.
The problem seems to have been fixed in iOS 17.
The code I posted above no longer crashes on iOS 17.
I have described the problem in more detail in this topic and posted the code that can cause the crash:
https://developer.apple.com/forums/thread/718398
It's a bug in iOS 16. With iOS 15.7.8 everything works and there is no crash in the print preview.
On an old iPhone 6s with iOS 15.7.8, this code works without problems and the print preview does not crash. But the print preview crashes on an iPhone 11 Pro Max with iOS 16.6. It's clearly an iOS 16 issue.
We now have a simple test project with which we can cause the print preview to crash very often on a iPad Pro 12.9" 3. Generation with iOS 16.6.
It often crashes when the print preview has finished "Gathering printer information".
Call with a UIButton this action:
- (IBAction)print:(id)sender
{
UIPrintInteractionController *printInteractionController = [UIPrintInteractionController sharedPrintController];
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
NSString* AppName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
printInfo.jobName = AppName;
printInfo.duplex = UIPrintInfoDuplexNone;
printInteractionController.printInfo = printInfo;
printInteractionController.showsPaperSelectionForLoadedPapers = YES;
UIPrintInteractionCompletionHandler completionHandler = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error)
{
//
};
PrintPageRenderer *pageRenderer = [[PrintPageRenderer alloc]init];
printInteractionController.delegate = pageRenderer;
printInteractionController.printPageRenderer = pageRenderer;
if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
{
CGRect rect = CGRectMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2, 1, 1);
[printInteractionController presentFromRect:rect inView: self.view animated:YES
completionHandler:completionHandler];
}
else
{
[printInteractionController presentAnimated:YES completionHandler:completionHandler];
}
}
The PrintPageRenderer.h:
#import <UIKit/UIKit.h>
@interface PrintPageRenderer : UIPrintPageRenderer <UIPrintInteractionControllerDelegate>
@end
The PrintPageRenderer.m:
#import "PrintPageRenderer.h"
@implementation PrintPageRenderer
-(NSInteger)numberOfPages
{
return 15;
}
- (void)drawPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)printableRect
{
for (int i = 0; i< 1000; i++)
{
[[self randomColor] setFill];
UIRectFill([self randomRectWithinPrintableRect:printableRect]);
}
}
-(CGRect) randomRectWithinPrintableRect:(CGRect) printableRect
{
CGFloat randomWidth = arc4random_uniform((uint32_t)CGRectGetWidth(printableRect));
CGFloat randomHeight = arc4random_uniform((uint32_t)CGRectGetHeight(printableRect));
CGFloat randomX = CGRectGetMinX(printableRect) + arc4random_uniform((uint32_t)(CGRectGetWidth(printableRect) - randomWidth));
CGFloat randomY = CGRectGetMinY(printableRect) + arc4random_uniform((uint32_t)(CGRectGetHeight(printableRect) - randomHeight));
CGRect randomRect = CGRectMake(randomX, randomY, randomWidth, randomHeight);
return randomRect;
}
-(UIColor *)randomColor
{
CGFloat red = (CGFloat)arc4random_uniform(256) / 255.0;
CGFloat green = (CGFloat)arc4random_uniform(256) / 255.0;
CGFloat blue = (CGFloat)arc4random_uniform(256) / 255.0;
return [UIColor colorWithRed:red green:green blue:blue alpha:1.0];
}
@end
This is the output in the console that can be seen when the print preview crashes. But the same output appears at that moment even if the app does not crash. This probably has nothing to do with the crash.
2023-09-08 10:44:13.763186+0200 AAAAAAAAAAAAA[1250:306713] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x280e58be0 V:|-(0)-[UIView:0x101a75210] (active, names: '|':_UITableViewHeaderFooterContentView:0x101a74a00 )>",
"<NSLayoutConstraint:0x280e58c30 UIView:0x101a75210.bottom == _UITableViewHeaderFooterContentView:0x101a74a00.bottom (active)>",
"<NSLayoutConstraint:0x280e58a00 UILabel:0x101a75f30.top == UIView:0x101a75210.topMargin (active)>",
"<NSLayoutConstraint:0x280e58dc0 UILabel:0x101a75f30.bottom == UIView:0x101a75210.bottomMargin (active)>",
"<NSLayoutConstraint:0x280e590e0 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x2814271e0'UIViewLayoutMarginsGuide']-(8)-| (active, names: '|':UIView:0x101a75210 )>",
"<NSLayoutConstraint:0x280ea9720 'UIView-Encapsulated-Layout-Height' _UITableViewHeaderFooterContentView:0x101a74a00.height == 10 (active)>",
"<NSLayoutConstraint:0x280e58d70 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x2814271e0'UIViewLayoutMarginsGuide'] (active, names: '|':UIView:0x101a75210 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x280e58dc0 UILabel:0x101a75f30.bottom == UIView:0x101a75210.bottomMargin (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
Stack trace 2:
Incident Identifier: F335434E-C8BF-4EF1-8F60-AAAAAAAAAAAAA
Hardware Model: iPhone12,5
Process: AAAAAAAAAAAAA [16141]
Path: /private/var/containers/Bundle/Application/441F63E7-002F-4405-97C8-AAAAAAAAAAAAA/AAAAAAAAAAAAA.app/AAAAAAAAAAAAA
Identifier: AAAAAAAAAAAAA.AAAAAAAAAAAAA.AAAAAAAAAAAAA
Version: 2.3 (1.0)
AppStoreTools: 14E221
AppVariant: 1:iPhone12,5:15
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: AAAAAAAAAAAAA.AAAAAAAAAAAAA.AAAAAAAAAAAAA [2510]
Date/Time: 2023-07-13 09:48:24.8882 -0400
Launch Time: 2023-07-12 18:37:54.2619 -0400
OS Version: iPhone OS 16.5.1 (20F75)
Release Type: User
Baseband Version: 4.02.01
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000008
Exception Codes: 0x0000000000000001, 0x0000000000000008
VM Region Info: 0x8 is not in any region. Bytes before following region: 68719476728
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
commpage (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated)
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [16141]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 CoreGraphics 0x000000019c7e9d7c CGContextDrawPDFPageWithDrawingCallbacks + 116 (CGPDFPage.c:547)
1 CoreGraphics 0x000000019c787fbc CGContextDrawPDFPage + 36 (CGPDFPage.c:513)
2 PrintKitUI 0x00000001e43967e4 getPageImageForPage + 1632 (UIPrintPreviewHelper.m:0)
3 PrintKitUI 0x00000001e43b8b44 -[UIPrintPreviewPageFetcher _drawPageContextIntoImage:] + 296 (UIPrintPreviewPageFetcher.m:233)
4 PrintKitUI 0x00000001e43b83c8 -[UIPrintPreviewPageFetcher sheetImageForItemAt:] + 112 (UIPrintPreviewPageFetcher.m:129)
5 PrintKitUI 0x00000001e4389214 -[UIPrintPreviewViewController collectionView:cellForItemAtIndexPath:] + 132 (UIPrintPreviewViewController.m:491)
6 UIKitCore 0x000000019ce83a44 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 980 (UICollectionView.m:3386)
7 UIKitCore 0x000000019d4340cc -[UICollectionView _createVisibleViewsForSingleCategoryAttributes:limitCreation:fadeForBoundsChange:] + 1120 (UICollectionView.m:5418)
8 UIKitCore 0x000000019d4343a4 -[UICollectionView _createVisibleViewsForAttributes:fadeForBoundsChange:notifyLayoutForVisibleCellsPass:] + 288 (UICollectionView.m:5483)
9 UIKitCore 0x000000019cd636dc -[UICollectionView _updateVisibleCellsNow:] + 1612 (UICollectionView.m:5005)
10 UIKitCore 0x000000019cd62fa0 -[UICollectionView layoutSubviews] + 304 (UICollectionView.m:6192)
11 UIKitCore 0x000000019cd3ebe0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1992 (UIView.m:18678)
12 QuartzCore 0x000000019c1f9074 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
13 QuartzCore 0x000000019c20c5f0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 (CALayer.mm:2519)
14 QuartzCore 0x000000019c21da1c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714)
15 QuartzCore 0x000000019c24cff4 CA::Transaction::commit() + 648 (CATransactionInternal.mm:432)
16 QuartzCore 0x000000019c236f3c CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:940)
17 CoreFoundation 0x000000019ad5b234 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1789)
18 CoreFoundation 0x000000019ace5410 __CFRunLoopDoObservers + 532 (CFRunLoop.c:1902)
19 CoreFoundation 0x000000019ad4519c __CFRunLoopRun + 1028 (CFRunLoop.c:2981)
20 CoreFoundation 0x000000019ad4a3ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
21 GraphicsServices 0x00000001d61e735c GSEventRunModal + 164 (GSEvent.c:2196)
22 UIKitCore 0x000000019d0d76e8 -[UIApplication _run] + 888 (UIApplication.m:3782)
23 UIKitCore 0x000000019d0d734c UIApplicationMain + 340 (UIApplication.m:5372)
24 AAAAAAAAAAAAA 0x0000000104c1438c main + 80 (main.m:16)
25 dyld 0x00000001ba222dec start + 2220 (dyldMain.cpp:1165)
With all of our apps where images are printed on multiple pages, we have seen a lot of crashes since iOS 16, but with iOS 16.6 it seems to have gotten much worse. We also have an iPad here that crashes every now and then or even several times in a row when printing. The crash happens in the print preview and we have no way to catch or prevent it. We are using UIPrintInteractionController with UIPrintPageRenderer, Objective C and minimum deployment target iOS 13.
On this iPad, also the “Photos” app sometimes crashes during the print preview when printing multiple images.
We created a test project in which we print 30 pages on which we draw random rectangles within the printableRect. In this test project, the app does not crash even with this iPad. We'll try drawing a picture instead of rectangles. Maybe then it will crash. We wanted to submit this test project to Apple with the crash description, but the test project did not generate the crash.
Stack trace 1:
Incident Identifier: B2BCB81B-4444-47F7-9D15-AAAAAAAAAAAAA
Hardware Model: iPhone14,5
Process: AAAAAAAAAAAAA [37220]
Path: /private/var/containers/Bundle/Application/99AEC7F0-E7AB-4623-93F3-AAAAAAAAAAAAA/AAAAAAAAAAAAA.app/AAAAAAAAAAAAA
Identifier: AAAAAAAAAAAAA.AAAAAAAAAAAAA.AAAAAAAAAAAAA
Version: 2.4 (1.0)
AppStoreTools: 14E221
AppVariant: 1:iPhone14,5:15
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: AAAAAAAAAAAAA.AAAAAAAAAAAAA.AAAAAAAAAAAAA [2071]
Date/Time: 2023-09-06 18:47:04.7501 -0400
Launch Time: 2023-09-06 18:43:02.3140 -0400
OS Version: iPhone OS 16.6 (20G75)
Release Type: User
Baseband Version: 2.80.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: AAAAAAAAAAAAA [37220]
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x1d1de8cb4 __exceptionPreprocess + 164 (NSException.m:202)
1 libobjc.A.dylib 0x1cae843d0 objc_exception_throw + 60 (objc-exception.mm:356)
2 Foundation 0x1cc57a54c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 188 (NSException.m:242)
3 UIKitCore 0x1d45504f4 -[UICollectionView _Bug_Detected_In_Client_Of_UICollectionView_Invalid_Number_Of_Items_In_Section:] + 96 (UICollectionView.m:10074)
4 UIKitCore 0x1d415b5a8 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 9916 (UICollectionView.m:9989)
5 UIKitCore 0x1d40b9d5c -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 396 (UICollectionView.m:9346)
6 UIKitCore 0x1d40bb0e0 -[UICollectionView reloadItemsAtIndexPaths:] + 52 (UICollectionView.m:9366)
7 PrintKitUI 0x21b53d77c __55-[UIPrintPreviewViewController updatePrintPreviewInfo:]_block_invoke_3 + 80 (UIPrintPreviewViewController.m:348)
8 UIKitCore 0x1d3e7e494 +[UIView(Animation) performWithoutAnimation:] + 76 (UIView.m:14822)
9 PrintKitUI 0x21b53d6c8 __55-[UIPrintPreviewViewController updatePrintPreviewInfo:]_block_invoke + 580 (UIPrintPreviewViewController.m:347)
10 PrintKitUI 0x21b56eb30 -[UIPrintPreviewPageFetcher resetAllPages:] + 56 (UIPrintPreviewPageFetcher.m:589)
11 PrintKitUI 0x21b53d460 -[UIPrintPreviewViewController updatePrintPreviewInfo:] + 144 (UIPrintPreviewViewController.m:327)
12 PrintKitUI 0x21b55eb84 -[UIPrintPanelViewController updatePrintPreviewInfo] + 72 (UIPrintPanelViewController.m:537)
13 PrintKitUI 0x21b55cdb8 -[UIPrintPanelViewController observeValueForKeyPath:ofObject:change:context:] + 332 (UIPrintPanelViewController.m:258)
14 Foundation 0x1cc0d50d0 NSKeyValueNotifyObserver + 252 (NSKeyValueObserving.m:437)
15 Foundation 0x1cc0eb618 NSKeyValueDidChange + 356 (NSKeyValueObserving.m:556)
16 Foundation 0x1cc0d8518 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 680 (NSKeyValueObserving.m:2661)
17 Foundation 0x1cc0d8248 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64 (NSKeyValueObserving.m:2676)
18 Foundation 0x1cc0d77dc _NSSetObjectValueAndNotify + 284 (NSKeyValueObserverNotifying.m:111)
19 PrintKitUI 0x21b54e830 -[UIPrintPagesPerSheetOption listItemSelected:] + 280 (UIPrintLayoutOptions.m:311)
20 PrintKitUI 0x21b52e17c -[UIPrintOptionListViewController tableView:didSelectRowAtIndexPath:] + 116 (UIPrintOptionCells.m:107)
21 UIKitCore 0x1d4ce1334 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] + 1196 (UITableView.m:9283)
22 UIKitCore 0x1d4ce1648 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 256 (UITableView.m:9337)
23 UIKitCore 0x1d3fedca8 -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:137)
24 UIKitCore 0x1d3fedbdc -[_UIAfterCACommitQueue flush] + 168 (_UIAfterCACommitQueue.m:228)
25 UIKitCore 0x1d3fedaf0 _runAfterCACommitDeferredBlocks + 496 (UIApplication.m:3249)
26 UIKitCore 0x1d3e8c428 _cleanUpAfterCAFlushAndRunDeferredBlocks + 108 (UIApplication.m:3213)
27 UIKitCore 0x1d434b4e4 _UIApplicationFlushCATransaction + 72 (UIApplication.m:3290)
28 UIKitCore 0x1d449bd94 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:114)
29 UIKitCore 0x1d4b00894 schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:1015)
30 UIKitCore 0x1d4affdf0 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1164)
31 CoreFoundation 0x1d1eb2128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
32 CoreFoundation 0x1d1ebe7b4 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
33 CoreFoundation 0x1d1e435e8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
34 CoreFoundation 0x1d1e590d4 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
35 CoreFoundation 0x1d1e5e3ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
36 GraphicsServices 0x20d37435c GSEventRunModal + 164 (GSEvent.c:2196)
37 UIKitCore 0x1d41eaf58 -[UIApplication _run] + 888 (UIApplication.m:3782)
We have been developing a new app for scanning documents and photos for six months. This app has many unique features that other apps don't have.
The app automatically detects holes on the documents that have been punched with a hole punch and removes them from the document.
The corners of the detected document are automatically moved inwards to get clean edges, the user can set how many pixels to indented.
This app recognises the text very accurately and inserts it into the PDF document behind the image at the exact position and text size as the text on the image.
The PDF generated by the app can be searched for text and the text can be marked and copied.
Another important feature that no other app in the App Store offers is the function that all four corners of the document are shown enlarged in four circles and are visible at the same time.
The user can see immediately if the corners have been recognized satisfactorily or if they should be corrected.
The user can move the corners either on the document or directly in the circles.
This feature is very suitable for users with visual impairment and makes it easier to use for disabled people.
We also put a lot of work into the very small file size of the generated PDF.
The quality improvement of the documents is very good. We filter away almost all noise, disturbances and dirt spots and improve the appearance of the text enormously.
In addition, we translated the app, the app description and the keywords into 33 languages.
We created and uploaded 1320 screenshots with a lot of effort. (33 languages x 10 screenshots x 4 devices)
Our two daughters (10 and 12 years old) worked on the app for the first time in their lives.
They helped us with the design, tested the app, took some screenshots, contributed ideas for the description for the store.
Happy to finally finish the app after long months, we submitted it for review.
The next day the rejection: Guideline 4.3 - Design
We were shocked. We have 19 apps in the App Store for many years. One of these apps has a similar design to the new app in some views.
But the functionality of the two apps is completely different. These apps are impossible to combine into one.
And why should we reinvent the design of every app from scratch when it works very well and looks good?
The requests for the exact reason for the rejection in the app review page are not answered. The same rejection text is written back every time.
We have submitted an appeal but have not received a response yet.
We are now worried and uncertain. We had other new app projects planned, but it's too dangerous to invest money and hard work for months and then find out that the app is being rejected.
A large part of our income comes from revenue from the App Store. Our apps have millions of active users.
Now we are really thinking about whether we should urgently focus on a business in a completely different area.
After all, we have two children counting on us.
The exact text of the rejection:
Guideline 4.3 - Design
We noticed that your app provides the same feature set as other apps submitted to the App Store; it simply varies in content or language, which is considered a form of spam.
The next submission of this app may require a longer review time.
Next Steps
Review the Design section of the App Store Review Guidelines.
Ensure your app is compliant with all sections of the App Store Review Guidelines and the Terms & Conditions of the Apple Developer Program.
Once your app is fully compliant, resubmit your app for review.
When creating multiple apps where content is the only varying element, you should offer a single app to deliver differing content to customers. If you would like to offer this content for purchase, it would be appropriate to use the in-app purchase API.
Alternatively, you may consider creating a web app, which looks and behaves similar to a native app when the customer adds it to their Home screen. Refer to the Configuring Web Applications section of the Safari Web Content Guide for more information.
Submitting apps designed to mislead or harm customers or evade the review process may result in the termination of your Apple Developer Program account. Review the Terms & Conditions of the Apple Developer Program to learn more about our policies regarding termination.
Our workaround is to do all storyboard work with XCode 13.4.1.
There are no problems with that version. Of course, it's not a long-term solution.
It looks like it has been fixed again in iOS version 15.7.3.
So far we haven't had any crashes reported with this new version.