When UICollectionViewFlowLayoutAlertForInvalidItemSize Occured
Some Log Like These Occurred, and then app crash
*** Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410
crash Output
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 16}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.'
Post
Replies
Boosts
Views
Activity
There Many Crash Report Like this, But no any code about my business can tell me why, so I think this is a system bug, Who can tell me why and how to avoid it?
Thread 19 Crashed:
0 CoreFoundation __exceptionPreprocess +224
1 libobjc.A.dylib objc_exception_throw +56
2 CoreFoundation -[__NSSingleObjectEnumerator initWithObject:collection:] +0
3 CFNetwork _CFHTTPServerResponseEnqueue +24424
4 CFNetwork _CFHTTPServerResponseEnqueue +22476
5 CFNetwork _CFHTTPServerResponseEnqueue +31004
6 CFNetwork _CFHTTPMessageSetResponseProxyURL +8652
7 CFNetwork 0x00000001a09a6138 0x1a09a1000 + 20792
8 CFNetwork CFURLDownloadCancel +35396
9 CFNetwork CFURLDownloadCancel +29408
10 CFNetwork 0x00000001a09aa444 0x1a09a1000 + 37956
11 CFNetwork 0x00000001a09a7cf0 0x1a09a1000 + 27888
12 CFNetwork CFURLDownloadCancel +41784
13 libdispatch.dylib _dispatch_block_async_invoke2 +104
14 libdispatch.dylib _dispatch_client_callout +16
15 libdispatch.dylib _dispatch_lane_serial_drain$VARIANT$mp +608
16 libdispatch.dylib _dispatch_lane_invoke$VARIANT$mp +464
17 libdispatch.dylib _dispatch_workloop_worker_thread +588
18 libsystem_pthread.dylib _pthread_wqthread +272
19 libsystem_pthread.dylib start_wqthread +8
I have sent the crash file here, that i removed some information about my app
crash.crash
AnyOne Can tell me what's different about MXMemoryMetric and phys_footprint?
Which is the really one dicide the app should be killed by OOM?
In my Singleton Class,I used [UIImage imageNamed:] in the block of dispatch_once,it sometimes crash,I have thought many days,my image is stored in my App(Not in Assets,In My custom Resource File),it's unbelievable,who can tell me why?
This is my Code
static dispatch_once_t onceToken;
static AClass *manager = nil;
dispatch_once(&onceToken, ^{
manager = [[AClass alloc] init];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSMutableArray * imgDataList = [NSMutableArray array];
for (int i=0; i<=15; i++) {
NSString *imageName=[NSString stringWithFormat:@"imageNamedxx_%d@2x.png",i];
UIImage * img = [UIImage imageNamed:imageName];
if (img) {
[imgDataList addObject:img];
}
}
dispatch_async(dispatch_get_main_queue(), ^{
manager.liveImgData = [imgDataList copy];
});
});
});
return manager;
}
1
libobjc.A.dylib
objc_exception_throw
2
CoreFoundation
-[CFPrefsSearchListSource addManagedSourceForIdentifier:user:]
3
Foundation
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4
UIKitCore
-[_UIImageCGImageContent initWithCGImage:scale:]
5
UIKitCore
-[CUINamedImage(UIKitAdditions) UIImageWithAsset:configuration:flippedHorizontally:optionalVectorImage:]
6
UIKitCore
-[UIImageAsset imageWithConfiguration:]
7
UIKitCore
-[_UIPathLazyImageAsset imageWithConfiguration:]
8
UIKitCore
+[UIImage imageNamed:inBundle:withConfiguration:]
myApp
AClass - 第 42 行([UIImage imageNamed:])
__34+[AClass shareInstance]_block_invoke_2 + 42
I output the package size report according to the document, and found that the package size increase appears on systems that do not support WidgetKit, such as iOS11. I think this is wrong. WidgetKit is only used in iOS14. Why should the package size of low-level systems become larger?
1、Report With WidgetKit Of low-level systems
Supported variant descriptors: [device: iPhone10,2, os-version: 11.0], [device: iPhone10,3, os-version: 11.0], [device: iPhone10,5, os-version: 11.0], [device: iPhone9,4, os-version: 10.0], [device: iPhone9,2, os-version: 10.0], and [device: iPhone10,6, os-version: 11.0]
App + On Demand Resources size: 76.4 MB compressed, 162.4 MB uncompressed
App size: 76.4 MB compressed, 162.4 MB uncompressed
On Demand Resources size: Zero KB compressed, Zero KB uncompressed
2、 Report Without WidgetKit Of low-level systems
Supported variant descriptors: [device: iPhone10,3, os-version: 11.0], [device: iPhone9,2, os-version: 10.0], [device: iPhone10,2, os-version: 11.0], [device: iPhone10,5, os-version: 11.0], [device: iPhone10,6, os-version: 11.0], and [device: iPhone9,4, os-version: 10.0]
App + On Demand Resources size: 75.8 MB compressed, 160.6 MB uncompressed
App size: 75.8 MB compressed, 160.6 MB uncompressed
On Demand Resources size: Zero KB compressed, Zero KB uncompressed
Version 12.0 beta 6 (12A8189n)
I Down the Sample Code From Apple, The Example App For App Clips, Fruta.
When I built It with the Xcode 12 Bate4 , Error was happened, Who can tell me Why? Some one else has built the App Fruta?
The Error Code:
#if APPCLIP
Text("App Store Overlay")
.hidden()
.appStoreOverlay(isPresented: $presentingAppStoreOverlay)
{
			 SKOverlay.AppClipConfiguration(position: .bottom)
}
#endif
The complete Code:
var body: some View {
VStack(spacing: 0) {
Spacer()
orderStatusCard
Spacer()
if presentingBottomBanner {
bottomBanner
}
#if APPCLIP
Text("App Store Overlay")
.hidden()
.appStoreOverlay(isPresented: $presentingAppStoreOverlay) {
SKOverlay.AppClipConfiguration(position: .bottom)
}
#endif
}
.onChange(of: model.hasAccount) { _ in
#if APPCLIP
if model.hasAccount {
presentingAppStoreOverlay = true
}
#endif
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(
ZStack {
if let order = model.order {
order.smoothie.image
.resizable()
.aspectRatio(contentMode: .fill)
} else {
Color("order-placed-background")
}
blurView
.opacity(model.order!.isReady ? 0 : 1)
}
.edgesIgnoringSafeArea(.all)
)
.animation(.spring(response: 0.25, dampingFraction: 1), value: orderReady)
.animation(.spring(response: 0.25, dampingFraction: 1), value: model.hasAccount)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
self.model.orderReadyForPickup()
}
#if APPCLIP
if model.hasAccount {
presentingAppStoreOverlay = true
}
#endif
}
}
When I develop My WidgetKit Extension,I set some breakpoints for my code In the App Target And Extension Target ,It don't work,Who can help me solve this problem? Thank you!