I can run my app on my MacBook Pro running macOS 10.14.6, but an App Store user reached out to report that it crashes immediately when launching it. When that user runs it from the Terminal, it prints out this:Illegal instruction: 4
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
My Mac app uses many NSTextViews just fine for printing a long string, but trying to do the same on iOS with many UITextViews and associated UIViewPrintFormatters just causes a crash.*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23d03ab1 _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff23b83bf9 -[__NSArrayM objectAtIndex:] + 169
4 UIKitCore 0x00007fff48029503 -[UITextViewPrintFormatter rectForPageAtIndex:] + 86
5 UIKitCore 0x00007fff4806bc79 __57-[UIPrintPageRenderer drawPrintFormatter:forPageAtIndex:]_block_invoke + 41
6 UIKitCore 0x00007fff4806bcf9 __57-[UIPrintPageRenderer drawPrintFormatter:forPageAtIndex:]_block_invoke.43 + 29
7 libdispatch.dylib 0x000000010e4f6d48 _dispatch_client_callout + 8
8 libdispatch.dylib 0x000000010e505b24 _dispatch_async_and_wait_invoke + 175
9 libdispatch.dylib 0x000000010e4f6d48 _dispatch_client_callout + 8
10 libdispatch.dylib 0x000000010e504de6 _dispatch_main_queue_callback_4CF + 1500
11 CoreFoundation 0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
12 CoreFoundation 0x00007fff23bceca9 __CFRunLoopRun + 2329
13 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
14 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
15 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
16 myApp 0x000000010e1ca61b main + 75
17 libdyld.dylib 0x00007fff5227ec25 start + 1
18 ??? 0x0000000000000001 0x0 + 1
)Here's the code:class ViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
let printController = UIPrintInteractionController.shared
let printPageRenderer = PrintPageRenderer()
printController.printPageRenderer = printPageRenderer
printController.present(animated: true)
}
}
class PrintPageRenderer: UIPrintPageRenderer {
let layoutManager = NSLayoutManager()
let textStorage = NSTextStorage(string: "fhdjksalhfj dskla fjf")
var textViews = [UITextView]()
override func prepare(forDrawingPages range: NSRange) {
DispatchQueue.main.sync {
for (i, textView) in textViews.enumerated() {
let printFormatter = textView.viewPrintFormatter()
addPrintFormatter(printFormatter, startingAtPageAt: i)
}
}
}
override var numberOfPages: Int {
textStorage.addLayoutManager(layoutManager)
let size = CGFloat(50)
for _ in 0..<2 {
let textContainer = NSTextContainer(size: CGSize(width: size, height: size))
layoutManager.addTextContainer(textContainer)
let textView = UITextView(frame: CGRect(x: 0, y: 0, width: size, height: size), textContainer: textContainer)
textViews.append(textView)
}
return textViews.count
}
}My goal is printing a document from an attributed string and showing a custom header and footer on each page.
I create a URL bookmark with `URL.bookmarkData(options: [], includingResourceValuesForKeys: [.localizedNameKey])` and resolve it with `NSURL(resolvingBookmarkData: bookmarkData, options: [], relativeTo: nil, bookmarkDataIsStale: nil) as URL`. This works fine within my main app, but when sharing the bookmarkData via an App Group with my Share Extension, it gives the error "The file couldn't be opened because you don't have permission to view it.". Is there any way I can do this?
It seems that timeControlStatus == .paused and rate == 0 when the video is being played fast forward or backward. Is this really how it's supposed to be? If yes, is there a way of knowing if the video is effectively paused?
Can I delete it? Why is it still there? I already created a feedback for this in June but got no response.
After building the Product Archive, the Organizer window opens, I click Distribute App. Next. Next. Next. Next. Crash. The crash happens before I'm able to export anything, so I cannot even use the Application Loader. The last message above the indeterminate progress indicator I can read before it crashes is "Packaging MyApp ...".
It would be really nice if an Apple engineer could help sort this out, because I already contacted the App Store Connect support and they told me that the only way I can get help is by writing on this forum, searching the Xcode documentation, or using one of the 2 free TSIs I get each year (which I have already used).
Stacktrace (I tried to paste the whole crash report, but I get an error that the message is too long and that I should click on the icon to attach a file instead, but I don't see such an icon):
Process:							 Xcode [834]
Path:									/Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:						com.apple.dt.Xcode
Version:							 12.2 (17535)
Build Info:						IDEFrameworks-17535000000000000~23 (12B45b)
App Item ID:					 497799835
App External ID:			 838360538
Code Type:						 X86-64 (Native)
Parent Process:				??? [1]
Responsible:					 Xcode [834]
User ID:							 501
Date/Time:						 2020-12-07 17:22:11.231 +0100
OS Version:						macOS 11.0.1 (20B29)
Report Version:				12
Bridge OS Version:		 3.0 (14Y908)
Anonymous UUID:				7A3F67B1-D68A-4230-40B2-B7EE13B51792
Sleep/Wake UUID:			 4913FE52-7DB5-45E0-9396-EFBA2ADD0B5C
Time Awake Since Boot: 47000 seconds
Time Since Wake:			 5900 seconds
System Integrity Protection: enabled
Crashed Thread:				17	Dispatch queue: ConcurrentQueue: -[IDEDistributionPackagingStepViewController viewDidInstall]_block_invoke
Exception Type:				EXC_CRASH (SIGABRT)
Exception Codes:			 0x0000000000000000, 0x0000000000000000
Exception Note:				EXC_CORPSE_NOTIFY
Application Specific Information:
Possibly stale failure hints from 2020-12-07 16:21:03 +0000:
	0: Calling block provided by:
	0	 DVTDispatchAsync (in DVTFoundation)
	1	 __56-[IDEArchiveProductSource updateArchivesWithCompletion:]_block_invoke_2 (in IDEProducts)
	2	 DVT_CALLING_CLIENT_BLOCK (in DVTFoundation)
	3	 __DVTDispatchAsync_block_invoke (in DVTFoundation)
	4	 _dispatch_call_block_and_release (in libdispatch.dylib)
	5	 _dispatch_client_callout (in libdispatch.dylib)
	6	 _dispatch_continuation_pop (in libdispatch.dylib)
	7	 _dispatch_async_redirect_invoke (in libdispatch.dylib)
	8	 _dispatch_root_queue_drain (in libdispatch.dylib)
	9	 _dispatch_worker_thread2 (in libdispatch.dylib)
10	 _pthread_wqthread (in libsystem_pthread.dylib)
11	 start_wqthread (in libsystem_pthread.dylib)
ProductBuildVersion: 12B45b
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-17518/DVTFoundation/FilePaths/DVTFilePath.m:912
Details:	url should be an instance inheriting from NSURL, but it is nil
Object:	 <DVTFilePath>
Method:	 +filePathForFileURL:
Thread:	 <NSThread: 0x7fa6c43458e0>{number = 4468, name = (null)}
Open FDs: 115/7168
Hints:	
	0: Calling block provided by:
	0	 DVTDispatchAsync (in DVTFoundation)
	1	 DVTAsyncPerformBlock (in DVTFoundation)
	2	 -[IDEDistributionPackagingStepViewController viewDidInstall] (in IDEKit)
	3	 -[DVTViewController _viewDidInstall] (in DVTViewControllerKit)
	4	 -[_DVTViewController_ViewLifecycleInterpositions viewDidMoveToWindow] (in DVTViewControllerKit)
	5	 -[NSView _setWindow:] (in AppKit)
	6	 -[NSView addSubview:] (in AppKit)
	7	 -[NSView setSubviews:] (in AppKit)
	8	 -[DVTBorderedView setContentView:] (in DVTUserInterfaceKit)
	9	 -[IDEDistributionAssistantWindowController setDistributionStepViewController:] (in IDEKit)
10	 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] (in Foundation)
11	 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] (in Foundation)
12	 _NSSetObjectValueAndNotify (in Foundation)
13	 -[IDEDistributionAssistantWindowController next:] (in IDEKit)
14	 __79-[IDEDistributionAutomaticSigningAssetsStepViewController _locateSigningAssets]_block_invoke_2 (in IDEKit)
15	 DVT_CALLING_CLIENT_BLOCK (in DVTFoundation)
16	 ___DVTAsyncPerformBlockOnMainRunLoop_block_invoke (in DVTFoundation)
17	 CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK (in CoreFoundation)
18	 __CFRunLoopDoBlocks (in CoreFoundation)
19	 __CFRunLoopRun (in CoreFoundation)
20	 CFRunLoopRunSpecific (in CoreFoundation)
21	 RunCurrentEventLoopInMode (in HIToolbox)
22	 ReceiveNextEventCommon (in HIToolbox)
23	 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
24	 _DPSNextEvent (in AppKit)
25	 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
26	 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
27	 -[NSApplication run] (in AppKit)
28	 NSApplicationMain (in AppKit)
29	 start (in libdyld.dylib)
Backtrace:
	0	 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit)
	1	 _DVTAssertionHandler (in DVTFoundation)
	2	 _DVTAssertionFailureHandler (in DVTFoundation)
	3	 +[DVTFilePath filePathForFileURL:] (in DVTFoundation)
	4	 -[IDEDistributionSymbolsStep runWithError:] (in IDEFoundation)
	5	 -[IDEDistributionProcessingPipeline process:] (in IDEFoundation)
	6	 -[IDEDistributionPackagingStepViewController _runPipeline] (in IDEKit)
	7	 __60-[IDEDistributionPackagingStepViewController viewDidInstall]_block_invoke_2 (in IDEKit)
	8	 DVT_CALLING_CLIENT_BLOCK (in DVTFoundation)
	9	 __DVTDispatchAsync_block_invoke (in DVTFoundation)
10	 _dispatch_call_block_and_release (in libdispatch.dylib)
11	 _dispatch_client_callout (in libdispatch.dylib)
12	 _dispatch_continuation_pop (in libdispatch.dylib)
13	 _dispatch_async_redirect_invoke (in libdispatch.dylib)
14	 _dispatch_root_queue_drain (in libdispatch.dylib)
15	 _dispatch_worker_thread2 (in libdispatch.dylib)
16	 _pthread_wqthread (in libsystem_pthread.dylib)
17	 start_wqthread (in libsystem_pthread.dylib)
abort() called
Application Specific Signatures:
(url) != nil
...
It's been known for at least 4 months that there is no email notification for answers to own posts, like an Apple engineer confirmed here https://developer.apple.com/forums/thread/656787?login=true
Why does it take so long to fix a basic issue like this? How long will we have to check daily for new answers without being able to count on a simple notification?
In my app I have a main context A and a sub-context B which has A as its parent. In context B I insert many objects that are rarely needed, so I would like to just write them to disk without keeping them in memory. Currently I call contextB.reset() which frees some memory, but those objects still exist in context A. How can I wipe them out of context A without permanently deleting them and without affecting all the other entities that I fetch using context A? I cannot call contextA.reset() because then all the entity references that I still need become invalid, but I couldn't find a way of making a context selectively forget about entities.
Since March of 2020 Feedback Assistant started showing messages inside of feedbacks in the wrong order. For feedbacks where I respond shortly after a message from Apple, my response is actually shown before Apple's response, so that it is quite difficult reading those old reports. I haven't heard anything from Apple since, and this issue still happens. I keep hearing from the Apple support that Apple really cares about feedback, but why does it take so long to solve an issue that makes it so difficult handling and providing additional feedback?
I already filed a bug report for this issue in January 2020, but without a response until now. It keeps happening that while I'm typing a response to an issue, the text gets reset without reason and I have to type it all over again. Why does nobody care about fixing such annoying issues?
I'm trying to record video and audio and sending them over the network so that they can be played back in real time on other clients. I've managed to record and play back video successfully, but audio still cannot be played back (see AVAudioPlayer at the bottom of the code below). What am I doing wrong or what is missing? Thank you in advance for any input.
let captureSession = AVCaptureSession()
private func startVideoAudioFeed() {
let sessionPreset = AVCaptureSession.Preset.low
if captureSession.canSetSessionPreset(sessionPreset) {
captureSession.sessionPreset = sessionPreset
}
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .notDetermined:
AVCaptureDevice.requestAccess(for: .video) { success in
self.startVideoAudioFeed()
}
case .authorized:
captureSession.beginConfiguration()
let captureVideoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front)!
let captureVideoInput = try! AVCaptureDeviceInput(device: captureVideoDevice)
if captureSession.canAddInput(captureVideoInput) {
captureSession.addInput(captureVideoInput)
}
let captureVideoOutput = AVCaptureVideoDataOutput()
captureVideoOutput.setSampleBufferDelegate(self, queue: DispatchQueue.main)
if captureSession.canAddOutput(captureVideoOutput) {
captureSession.addOutput(captureVideoOutput)
}
captureSession.commitConfiguration()
captureSession.startRunning()
default:
break
}
switch AVCaptureDevice.authorizationStatus(for: .audio) {
case .notDetermined:
AVCaptureDevice.requestAccess(for: .audio) { success in
self.startVideoAudioFeed()
}
case .authorized:
captureSession.beginConfiguration()
let captureAudioDevice = AVCaptureDevice.default(for: .audio)!
let captureAudioInput = try! AVCaptureDeviceInput(device: captureAudioDevice)
if captureSession.canAddInput(captureAudioInput) {
captureSession.addInput(captureAudioInput)
}
let captureAudioOutput = AVCaptureAudioDataOutput()
captureAudioOutput.audioSettings = [AVFormatIDKey: kAudioFormatLinearPCM, AVNumberOfChannelsKey: NSNumber(value: 1), AVSampleRateKey: NSNumber(value: 44100)]
captureAudioOutput.setSampleBufferDelegate(self, queue: DispatchQueue.main)
if captureSession.canAddOutput(captureAudioOutput) {
captureSession.addOutput(captureAudioOutput)
}
captureSession.commitConfiguration()
default:
break
}
}
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
if let imageBuffer = sampleBuffer.imageBuffer {
let ciImage = CIImage(cvPixelBuffer: imageBuffer)
let cgImage = CIContext().createCGImage(ciImage, from: ciImage.extent)!
let data = CFDataCreateMutable(nil, 0)!
let imageDestination = CGImageDestinationCreateWithData(data, kUTTypeJPEG, 1, nil)!
CGImageDestinationAddImage(imageDestination, cgImage, [kCGImageDestinationLossyCompressionQuality: NSNumber(value: 0)] as CFDictionary)
CGImageDestinationFinalize(imageDestination)
play(data: data as Data)
} else if let dataBuffer = sampleBuffer.dataBuffer {
let data = try! dataBuffer.dataBytes()
play(data: data)
}
}
private func play(data: Data) {
if let image = CGImage(jpegDataProviderSource: CGDataProvider(data: data as CFData)!, decode: nil, shouldInterpolate: false, intent: .defaultIntent) {
				// image is a valid image
} else if let audioPlayer = try? AVAudioPlayer(data: data) {
audioPlayer.play()
				// audioPlayer is always nil with error: Error Domain=NSOSStatusErrorDomain Code=1954115647 "(null)"
}
}
By adding this code to the default SceneKit Xcode project, one can reproduce the issue (the default ship object is blurred when viewed directly by the camera, and sharp when viewed through the semi-transparent square):
cameraNode.camera!.wantsDepthOfField = true
cameraNode.camera!.focusDistance = 2
cameraNode.camera!.fStop = 0.5
let plane = SCNNode(geometry: SCNPlane(width: 1, height: 1))
plane.position = SCNVector3(x: 0.5, y: 0, z: 13)
plane.opacity = 0.5
scene.rootNode.addChildNode(plane)
Is this something expected, and is there a workaround for making objects seen through semi-transparent objects appear blurred as well?
This code strangely doesn't animate the fStop:
cameraNode.camera!.wantsDepthOfField = true
cameraNode.camera!.focusDistance = 2
let animation = CABasicAnimation(keyPath: "fStop")
animation.toValue = 0.5
animation.duration = 0.3
cameraNode.camera!.addAnimation(animation, forKey: nil)
while this one does:
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.3
cameraNode.camera!.fStop = 0.5
SCNTransaction.commit()
Why?
Since a year or so I get frequent email reminders for feedbacks to which Apple answered and to which I still didn't reply. The interval between Apple's answer and the automatic reminder can be as small as 5 days and are repeated weekly until I respond to them. There is apparently no way of disabling them. How can it be that I have to respond within 5 days and Apple can take up to 8 years (the longest I've waited for a response for now)? I've already reported this several times but to no avail. I would also like to be able to send weekly reminders to Apple for not responding to pressing issues, but unfortunately that's not possible and this comes across as being quite arrogant.
I create a URL bookmark with URL.bookmarkData(options: [], includingResourceValuesForKeys: [.localizedNameKey]) and resolve it with NSURL(resolvingBookmarkData: bookmarkData, options: [], relativeTo: nil, bookmarkDataIsStale: nil) asURL. This works fine within my main app, but when sharing the bookmarkData via an App Group with my Share Extension, it gives the error "The file couldn't be opened because you don't have permission to view it.". Is there any way I can do this?