Post not yet marked as solved
I have filed this as FB13722352. I am sharing it here because I haven't seen it mentioned anywhere online yet and am curious if anyone else has run into it.
In Xcode 15.3+, writing data to disk fails when running the tests for a Framework project in a fresh simulator. Specifically, if the selected simulator has never been launched before (i.e. is newly-created), any test execution that attempts to write data into the NSDocumentDirectory directory will fail for a period of time after the simulator is first launched (I've observed between 10s and 20s). After that period of time, the same data write action will succeed. It appears that Xcode 15.3+ is starting test execution too soon, without waiting a sufficient amount of time for the Simulator to fully boot. This issue does not occur in Xcode 15.2 or prior versions.
Since the issue only appears in a fresh (never-before booted) simulator, it is likely to pop up consistently in CI test runs (where simulators are not re-used). This can cause confusion because the same test would not fail locally when re-using an existing simulator.
When the issue appears, the file write API returns the following error:
Domain=NSCocoaErrorDomain Code=4 "The folder “testFile” doesn’t exist." UserInfo={NSFilePath=[...]/data/Documents/testFile, NSUserStringVariant=Folder, NSUnderlyingError= {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"} }
Reproduction Steps:
Open Xcode 15.3 or 15.4. Make sure Simulator.app is closed.
Using the "Devices and Simulators" window, create a new iPhone 15 Pro simulator with iOS 17.4 (other devices and OS versions work as well). Do not launch this new simulator.
Create a new Framework project and add a test that performs and then checks the output of a data write to the Document directory (see example test code below).
Select the new simulator (created in step 2) as the test run target and run the test.
Here's an example test that fails in the scenario outlined above:
- (void)testBasicRepro {
NSString *testString = @"Hello, World!";
NSData *data = [testString dataUsingEncoding:NSUnicodeStringEncoding];
// Get documents directory
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *testFileURL = [url URLByAppendingPathComponent:@"testFile"];
// Write the data
NSError *error;
bool result = [data writeToURL:testFileURL options:NSDataWritingAtomic error:&error];
// Check if it was successful
XCTAssertTrue(result);
XCTAssertNil(error);
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:testFileURL.path]);
}
Workaround
The workaround that I have come up with is to create a test that runs first (by disabling parallelization and randomization, and making sure the test class filename is alphabetically first). Alternatively, it could be called from the setUp method in any test files that are affected. This test performs a data write and checks the result in a loop in order to block until the data write succeeds (i.e. the Simulator is sufficiently booted for data write operations to complete).
- (void)testWorkaroundBug {
NSString *testString = @"Hello, World!";
NSData *data = [testString dataUsingEncoding:NSUnicodeStringEncoding];
NSError *error;
// Get documents directory
NSURL *documentsURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *testFileURL;
NSDate *startTime = [NSDate date];
NSLog(@"Starting test at %@", startTime);
for (int i = 0; i < 120; i++) {
// Create unique URL
testFileURL = [documentsURL URLByAppendingPathComponent:[NSString stringWithFormat:@"testFile-%@", @(i)]];
// Write the data
BOOL success = [data writeToURL:testFileURL options:NSDataWritingAtomic error:&error];
// Check if it exists
if (success && [[NSFileManager defaultManager] fileExistsAtPath:testFileURL.path]) {
NSLog(@"Test file %@ was created successfully! Elapsed time %@s", @(i), @(fabs([startTime timeIntervalSinceNow])));
return;
}
else {
NSLog(@"Test file %@ was not created. Error: %@. Sleeping for 0.5s and trying again.", @(i), error);
[NSThread sleepForTimeInterval:0.5];
}
}
}
Post not yet marked as solved
This code to write UIImage data as heic works in iOS simulator with iOS < 17.5
import AVFoundation
import UIKit
extension UIImage {
public var heic: Data? { heic() }
public func heic(compressionQuality: CGFloat = 1) -> Data? {
let mutableData = NSMutableData()
guard let destination = CGImageDestinationCreateWithData(mutableData, AVFileType.heic as CFString, 1, nil),
let cgImage = cgImage else {
return nil
}
let options: NSDictionary = [
kCGImageDestinationLossyCompressionQuality: compressionQuality,
kCGImagePropertyOrientation: cgImageOrientation.rawValue,
]
CGImageDestinationAddImage(destination, cgImage, options)
guard CGImageDestinationFinalize(destination) else { return nil }
return mutableData as Data
}
public var isHeicSupported: Bool {
(CGImageDestinationCopyTypeIdentifiers() as! [String]).contains("public.heic")
}
var cgImageOrientation: CGImagePropertyOrientation { .init(imageOrientation) }
}
extension CGImagePropertyOrientation {
init(_ uiOrientation: UIImage.Orientation) {
switch uiOrientation {
case .up: self = .up
case .upMirrored: self = .upMirrored
case .down: self = .down
case .downMirrored: self = .downMirrored
case .left: self = .left
case .leftMirrored: self = .leftMirrored
case .right: self = .right
case .rightMirrored: self = .rightMirrored
@unknown default:
fatalError()
}
}
}
But with iOS 17.5 simulator it seems to be broken.
The call of CGImageDestinationFinalize
writes this error into the console:
writeImageAtIndex:962: *** CMPhotoCompressionSessionAddImage: err = kCMPhotoError_UnsupportedOperation [-16994] (codec: 'hvc1')
On physical devices it still seems to work.
Is there any known workaround for the iOS simulator?
Post not yet marked as solved
Hello Developer Community,
I hope you all are doing well. We need your help to find out about one issue in Mac application deployment outside the App Store. As required notarization, if we want to release the product outside the App Store. We have built the application in ElectronJS and signed it with Developer ID Installer. The next step is notarization, where we get the issue. It says, "Team is not yet configured for notarization." We raised the problem with the Apple team 6 months ago and are still getting the same response from them: "Our engineering team is working on it." without having a timeline. I want to confirm if someone has had the same issue, how long it can take to resolve this, or if you have any solutions. Your support means a lot to us. Thanks.
Dhiren Patel
Post not yet marked as solved
Is anyone else having the same problems. We been contacting Apple for almost two week, have raised at least 3 or 4 claim tickets to get our issue resolved, but Apple does not/has not responded?
Does anyone have recommendation as to what we can do.
We are losing money as we cannot open up our App?
Thanks,
CDL
Post not yet marked as solved
Hi there,
I'm trying to upload a new build to my app, but I have a windows computer, so seems transporter is out of the equation.
Any recommendations to upload the new ipa?
A contractor with a mac took care of the original publishing of the app so I'm on my own for this one.
Thanks!
Evan
Post not yet marked as solved
I am trying to find the following icon. I have gone through all the icons in SF Symbols 5.1 but have been unable to locate it. Does anyone know what this icon is or how I can get it?
Post not yet marked as solved
I have tried
networksetup -setnetworkserviceenabled "USB 10/100/1000 LAN" on
networksetup -setnetworkserviceenabled "USB 10/100/1000 LAN" off
and same with ifconfig cmd
sudo ifconfig down
sudo ifconfig up
I am able to bounces the interfaces with these commands but the network connectivity is not restored properly for USB 10/100/1000 LAN interface
May I know is there any other way we can achieve this programmatically using network framework API available for Mac
Post not yet marked as solved
I was wondering if anyone knows why the sample project uses Task.detached everywhere because it seems highly non-standard, e.g. in ContentView:
.task {
Task.detached { @MainActor in
await flightData.load()
}
}
Instead, I would expect to see something like:
.task {
flightData = await controller.loadFlightData()
}
Or:
.task {
await controller.load(flightData: flightData)
}
Is the use of detached perhaps an attempt to work around some issue with ObservableObject published updates?
Post not yet marked as solved
Hello everyone, could someone help me please;
I am loading an application in testflight in my Apple Store Connect but when downloading the app on my iPhone device the app has an error and cannot start, I attach the error log that I get from my app.
log.crash
I am using these versions xcode and MAC versions
Post not yet marked as solved
I have an app that utilizes the Network Extension ( Packet Tunnel Provider ), but also uses MDNS to find local devices for data transfer via Network Extensions.
However, once connected over Peer to Peer using AWDL0 or NWConnections, it works as expected until a user shuts the screen down. It looks like there's a difference in behavior when the device is plugged in vs when it's on just battery alone.
So we can be happily sending data over p2p ( awdl0 ) then a screen shuts off and it kills the connection.
Is this expected behavior and if so is there documentation?
Also, Network Extensions do not appear to be able to discover over P2P, they can only connect to endpoints directly. Is this expected behavior?
My thoughts;
If a user allows both the Network Extension Permission and Local Network Permissions that the Network Extension should be able to discover peers via p2p. The connections ( if not asleep ) should stay active while in use.
I want to automatically load different views depending on OS (OSX or iOS). Is there a way that I can do this without the user having to click on a link? This is my code so far.
struct ContentView: View {
#if os(iOS)
var myOS = "iOS"
#elseif os(OSX)
var myOS = "OSX"
#else
var myOS = "Something Else"
#endif
var body: some View {
NavigationStack {
VStack {
Text("PLEASE WAIT....")
.font(.system(size: 24))
.fontWeight(.bold)
}
.padding()
if (myOS == "OSX"){
// Goto Screen for iMac
}
else{
// go to screen for iOS
}
}
}
}
If I use "NavigationLink", my understanding is that the user would need to click on a link. Is there some way to do this without user interaction?
Post not yet marked as solved
App crashing when clicking the icon of the app.
Log:
Post not yet marked as solved
Hello everyone,
I am developing a feature in my app where, upon receiving a push notification, the app should open automatically if it is closed and the screen is locked. If the device is unlocked, a persistent notification should appear and only be removed with user interaction.
We managed to implement this functionality on Android using some configurations and additional rules. With this, upon receiving a push notification, the app opens automatically or a permanent notification appears.
I would like to know how I can implement this functionality on iOS using Swift. Is there any specific configuration or API that allows the app to open automatically upon receiving a push notification or to display a persistent notification on the unlocked screen?
Thanks in advance for your help!
Post not yet marked as solved
Is there any possible way to run a background task in an iOS App when the app is forced quit or when the app is not in the App Switcher?
Post not yet marked as solved
Hello I have this issue where I have "shortcut keys" that I have added to a ViewController. When navigated to the ViewController I cannot use the "shortcut keys" right away. I first need to "press" anywhere on the screen to be able to use the shortcut.
I use this code:
- (void)viewDidLoad {
[super viewDidLoad];
UIKeyCommand* commandA = [UIKeyCommand keyCommandWithInput:@"a" modifierFlags:UIKeyModifierCommand action:@selector(handleCommand:)];
[self addKeyCommand:commandA];
}
- (void)handleCommand:(UIKeyCommand *)keyCommand {
// Hangup call.
[self btnIncomingAnswerPressed:NULL];
}
I am not sure why this happens, but I it would be really good if a user could use a shortcut key as soon as they navigate to the ViewControllor, instead of first have to press anywhere on the app.
Post not yet marked as solved
I have a project using SecKey. Everything was working fine. But my newest build in TestFlight has crashed iOS 17.4 above.
Could you help me to fix this problem?
Here is my bug.
Post not yet marked as solved
We've developed a macOS application that helps users manage other applications. This includes features like resizing applications through our application. However, this functionality works fine before integrating the sandbox, but stops working afterward.
In essence, our application is unable to resize other applications after being sandboxed. Any guidance on how to achieve this functionality within the sandbox restrictions would be greatly appreciated.
Thank you in advance for your assistance.
Post not yet marked as solved
What is the reason the hand-tracking joints have these axes? I'm trying to create a virtual hands model and that's a mess.
Post not yet marked as solved
Hi,
I am on version 2.2.11 of my app and I need some specific things tested. Honestly, I haven't had much luck with friends downloading and testing my app. I want people who will push the limits of the first flow of my app to hopefully produce edge cases which I can then fix.
I don't mind paying.
Any there any good services I can use to buy a batch of testers?
Is this approach above-board as far as Apple is concerned?
Thanks,
Ryan
Post not yet marked as solved
This crash has been troubling us for a long time. We have this crash report in every release of our App, but can't reproduce it.
Here is part of the crash info:
Incident Identifier: xxxx
Hardware Model: iPhone13,3
Process: MyApp [34550]
Path: /private/var/containers/Bundle/Application/xxxx/MyApp.app/MyApp
Identifier: ***.***
Version: *** (296)
AppStoreTools: 15F31c
AppVariant: 1:iPhone13,3:15
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: ***.*** [466]
Date/Time: 2024-05-19 13:59:10.9716 +0800
Launch Time: 2024-05-19 12:18:24.8753 +0800
OS Version: iPhone OS 16.6.1 (20G81)
Release Type: User
Baseband Version: 3.80.01
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x322e323400000000 -> 0x0000003400000000 (possible pointer authentication failure)
Exception Codes: 0x0000000000000001, 0x322e323400000000
VM Region Info: 0x3400000000 is in 0x1000000000-0x7000000000; bytes after start: 154618822656 bytes before end: 257698037759
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=NUL ...(unallocated)
---> GPU Carveout (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated)
UNUSED SPACE AT END
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 CoreGraphics 0x00000001bd1d0780 CGFontStrikeRelease + 76 (CGFontStrike.c:126)
1 CoreGraphics 0x00000001bd1dd0cc CGGlyphBuilderUnlockBitmaps + 476 (CGGlyphBuilder.cc:113)
2 CoreGraphics 0x00000001bd1eb8c8 render_glyphs + 412 (RIPContextDrawGlyphs.c:127)
3 CoreGraphics 0x00000001bd202ea4 draw_glyph_bitmaps + 1132 (RIPContextDrawGlyphs.c:210)
4 CoreGraphics 0x00000001bd21a0ec ripc_DrawGlyphs + 1320 (RIPContextDrawGlyphs.c:558)
5 CoreGraphics 0x00000001bd1d26d8 CG::DisplayList::executeEntries(std::__1::__wrap_iter<std::__1::unique_ptr<CG::DisplayListEntry const, std::__1::default_delete<CG::DisplayListEntry const> >*>, std::__1::__wrap_iter<std::__1::uniq... + 5852 (DisplayList.cpp:1657)
6 CoreGraphics 0x00000001bd1c86a8 CGDisplayListDrawInContextDelegate + 268 (DisplayList.cpp:2151)
7 QuartzCore 0x00000001bcc797d4 CABackingStoreUpdate_ + 468 (CABackingStore.cpp:1388)
8 QuartzCore 0x00000001bccf0c34 invocation function for block in CA::Layer::display_() + 64 (CALayer.mm:9699)
9 QuartzCore 0x00000001bcc78d54 -[CALayer _display] + 1720 (CALayer.mm:9732)
10 QuartzCore 0x00000001bcc785b4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 412 (CALayer.mm:2521)
11 QuartzCore 0x00000001bcc898d8 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714)
12 QuartzCore 0x00000001bccb8e80 CA::Transaction::commit() + 648 (CATransactionInternal.mm:432)
13 QuartzCore 0x00000001bcca2df0 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:940)
14 UIKitCore 0x00000001bdca34d0 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3286)
15 UIKitCore 0x00000001bddf3d94 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:114)
16 UIKitCore 0x00000001be458894 schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:1015)
17 UIKitCore 0x00000001be457df0 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1164)
18 CoreFoundation 0x00000001bb80a128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
19 CoreFoundation 0x00000001bb8167b4 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
20 CoreFoundation 0x00000001bb79b5e8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
21 CoreFoundation 0x00000001bb7b10d4 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
22 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
23 GraphicsServices 0x00000001f6ccc35c GSEventRunModal + 164 (GSEvent.c:2196)
24 UIKitCore 0x00000001bdb42f58 -[UIApplication _run] + 888 (UIApplication.m:3782)
25 UIKitCore 0x00000001bdb42bbc UIApplicationMain + 340 (UIApplication.m:5372)
26 MyApp 0x000000010468f978 main + 80 (main.m:15)
27 dyld 0x00000001dace8dec start + 2220 (dyldMain.cpp:1165)
Thread 1 name:
Thread 1:
0 libsystem_kernel.dylib 0x00000001fa6f6ca4 mach_msg2_trap + 8 (:-1)
1 libsystem_kernel.dylib 0x00000001fa709b74 mach_msg2_internal + 80 (mach_msg.c:201)
2 libsystem_kernel.dylib 0x00000001fa709e4c mach_msg_overwrite + 540 (mach_msg.c:0)
3 libsystem_kernel.dylib 0x00000001fa6f71e8 mach_msg + 24 (mach_msg.c:323)
4 CoreFoundation 0x00000001bb7b0024 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5 CoreFoundation 0x00000001bb7b1250 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7 Foundation 0x00000001b5a2efb4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8 Foundation 0x00000001b5a2ee9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9 UIKitCore 0x00000001bdc75cc8 -[UIEventFetcher threadMain] + 416 (UIEventFetcher.m:1376)
10 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963)
11 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893)
12 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1)
Thread 2:
0 libsystem_kernel.dylib 0x00000001fa6f7164 __semwait_signal + 8 (:-1)
1 libsystem_c.dylib 0x00000001c2c50888 nanosleep + 220 (nanosleep.c:104)
2 libsystem_c.dylib 0x00000001c2c61b1c sleep + 52 (sleep.c:62)
3 MyApp 0x00000001075ccb14 -[UTDCacheManager synchronizeData] + 104 (UTDCacheManager.m:133)
4 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963)
5 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893)
6 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1)