Posts

Post not yet marked as solved
2 Replies
440 Views
We have a macOS app that captures video & audio from local cameras (built-in and USB connected). It saves the captured footage in an AVFragmentedAsset on the local disk. While recording, the user can open and work with the saved AVFragmentedAsset from inside the app, and its duration is automatically updated as new frames are added to the file on disk. We were also able to open and view the asset from a shared directory on the recording Mac using a simple iOS app with its duration updated regularly. This was some months ago. Now I am trying to do the same on the latest versions of iOS and macOS and it does not work. Using the Xcode debugger I can see that the iOS app does not receive the AVAssetDurationDidChangeNotification. The asset on iOS is created with: self.capturedMovieAsset = [[AVFragmentedAsset alloc] initWithURL: fileURL options: @{ AVURLAssetPreferPreciseDurationAndTimingKey : @(YES) }]; The AVFragmentedAssetMinder is created after the asset's duration and hasFragments properties are loaded: self.fragmentedAssetMinder = [[AVFragmentedAssetMinder alloc] initWithAsset: self.capturedMovieAsset mindingInterval: 5]; and the observer is added after that: [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(fragmentedDurationChanged:) name: AVAssetDurationDidChangeNotification object: self.capturedMovieAsset]; The fragmentedDurationChanged: callback is never called on iOS. I am currently using a MacBook Pro (15-inch, 2019) and an iPhone 12 Pro, running the latest release versions of iOS 16.0.3, macOS 12.6 and Xcode 14.0.1. The strange thing is that it used to work, albeit on iOS 15.x. Is there a setting in smb or AVFoundation, that I can use to make this work?
Posted
by dareios.
Last updated
.
Post not yet marked as solved
2 Replies
842 Views
Hello everyone, I have a free Mac Store app with one In-App purchase for advanced features (non-consumable). I am testing receipt validation under Sandbox, and the initial receipt (for the free app running standalone and not under Xcode) downloads and validates as expected. When I make the In-App purchase the App Store interface comes up as expected, the SKPaymentQueue callbacks are called as expected but the receipt on disk does not change. The same thing, no change in the _MASReceipt file, happens when I call restoreCompletedTransactions, or I send a SKReceiptRefreshRequest. If I try to buy the In-App product Sandbox lists the product as already bought. My understanding is that I should get a In-App purchase record (attribute type 17) for every product bought (1 in this case) but this does not happen. All these on a Intel MacBookPro 2019, macOS 12.5, Xcode 13.4.1. Any ideas what am I doing wrong or where I should look for culprits? Thanks.
Posted
by dareios.
Last updated
.
Post not yet marked as solved
0 Replies
680 Views
I am converting an existing app to be distributed through the MacStore. The basic app will be free with 1 optional in-app purchase for the more advanced features. I have made all the changes to work under the App Sandbox while signed as a Developer ID Application and is running fine. I am using Xcode 13.4.1 on an Intel MacBook Pro 2019 running the latest Monterey 12.4. The app also has an embedded command-line tool. The entitlements defined for the app in Xcode are: <dict> <key>com.apple.security.app-sadbox</key> <true/> <key>com.apple.security.automation.apple-events</key> <true/> <key>com.apple.security.cs.disable-library-validation</key> <true/> <key>com.apple.security.device.audio-input</key> <true/> <key>com.apple.security.device.camera</key> <true/> <key>com.apple.security.files.bookmarks.app-scope</key> <true/> <key>com.apple.security.files.bookmarks.document-scope</key> <true/> <key>com.apple.security.files.user-selected.read-write</key> <true/> <key>com.apple.security.temporary-exception.apple-events</key> <array> <string>com.apple.mail</string> <string>com.microsoft.Outlook</string> </array> </dict> </plist> Now I am trying to implement the AppStore related functionality and the app crashes on launch with the error on the title. I have seen similar posts, like the https://developer.apple.com/forums/thread/680284 and others, but I am still in the dark on how to match the app entitlements to the provisioning profile. Anyone knows what I need to do or has any pointers? I attach the crash log and also list some related info below. Thanks in advance. Christos K. System log output: 2022-07-08 10:54:45.921902 (system/com.apple.ManagedClient [1090]) <Notice>: Successfully spawned ManagedClient[1090] because ipc (mach) 2022-07-08 10:54:45.962682 (gui/501/application.com.company.test.macapp.107123014.107124124.0911B94B-7E12-415F-BAA4-71857CEBFBBC [1088]) <Notice>: xpcproxy exited due to OS_REASON_CODESIGNING | When validating /Users/USER/Library/Developer/Xcode/DerivedData/CC-diufhjakujlivreioyidydxmvgof/Build/Products/Debug/CC AppStore.app/Contents/MacOS/CC AppStore: Code has restricted entitlements, but the validation of its code signature failed. Unsatisfied Entitlements: 2022-07-08 10:54:45.962689 (gui/501/application.com.company.test.macapp.107123014.107124124.0911B94B-7E12-415F-BAA4-71857CEBFBBC [1088]) <Warning>: removing service since it exited with consistent failure - OS_REASON_CODESIGNING | When validating /Users/USER/Library/Developer/Xcode/DerivedData/CC-diufhjakujlivreioyidydxmvgof/Build/Products/Debug/CC AppStore.app/Contents/MacOS/CC AppStore: Code has restricted entitlements, but the validation of its code signature failed. Unsatisfied Entitlements: > 2022-07-08 10:54:45.962693 (gui/501/application.com.company.test.macapp.107123014.107124124.0911B94B-7E12-415F-BAA4-71857CEBFBBC [1088]) <Notice>: exited with exit reason (namespace: 3 code: 0x1) - OS_REASON_CODESIGNING | When validating /Users/USER/Library/Developer/Xcode/DerivedData/CC-diufhjakujlivreioyidydxmvgof/Build/Products/Debug/CC AppStore.app/Contents/MacOS/CC AppStore: Code has restricted entitlements, but the validation of its code signature failed. Unsatisfied Entitlements: Output of running security cms -D -i ~/Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/AppStore.app/Contents/embedded.provisionprofile on the profile embedded in the app: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>AppIDName</key> <string>Testing Mac App ID</string> <key>ApplicationIdentifierPrefix</key> <array> <string>1234567890</string> </array> <key>CreationDate</key> <date>2022-07-06T20:52:18Z</date> <key>Platform</key> <array> <string>OSX</string> </array> <key>IsXcodeManaged</key> <false/> <key>DeveloperCertificates</key> <array> <data>....</data> </array> <key>DER-Encoded-Profile</key> <data>...</data> <key>Entitlements</key> <dict> <key>com.apple.application-identifier</key> <string>1234567890.com.company.test.macapp</string> <key>keychain-access-groups</key> <array> <string>1234567890.*</string> </array> <key>com.apple.developer.team-identifier</key> <string>1234567890</string> </dict> <key>ExpirationDate</key> <date>2023-07-06T11:10:10Z</date> <key>Name</key> <string>Test MacApp distribution prov profile</string> <key>TeamIdentifier</key> <array> <string>1234567890</string> </array> <key>TeamName</key> <string>Company Ltd</string> <key>TimeToLive</key> <integer>364</integer> <key>UUID</key> <string>b48b9de2-14b5-4ba9-ba21-f144ac5a0811</string> <key>Version</key> <integer>1</integer> </dict> </plist> CrashLog.txt
Posted
by dareios.
Last updated
.
Post not yet marked as solved
0 Replies
588 Views
Hi, In our app we process frames captured from locally attached cameras to overlay static images and text. It is all standard AVFoundation calls like AVCaptureSession etc. From the captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection callback we call the following method to process the captured sample buffer before calling [self.videoWriterInput appendSampleBuffer: sampleBuffer] to write it to disk: - (CMSampleBufferRef) getProcessedVideoSample: (CMSampleBufferRef) sampleBuffer { CMSampleBufferRef newSamplelBuf = nil; @autoreleasepool { CMItemCount numSamples = CMSampleBufferGetNumSamples( sampleBuffer ); if (numSamples > 0) { CVImageBufferRef cvImageBuffer = CMSampleBufferGetImageBuffer( sampleBuffer ); CMSampleTimingInfo sampleTiming = { .duration = CMSampleBufferGetDuration( sampleBuffer ), .presentationTimeStamp = CMSampleBufferGetPresentationTimeStamp( sampleBuffer ), .decodeTimeStamp = CMSampleBufferGetDecodeTimeStamp( sampleBuffer ) }; CIImage *videoFrameImage = [CIImage imageWithCVPixelBuffer: cvImageBuffer]; CIImage *frameCIImage = nil; CVReturn error = kCVReturnError; Float64 escTimeSecs = CMTimeGetSeconds( sampleTiming.presentationTimeStamp ); long frameMatchMillis = [self.matchDescription matchTimeInMillisForActualTime: escTimeSecs]; CGImageRef baseOverlayImg = nil; @synchronized (self.liveOverlaysProject.staticImg_Lock) { baseOverlayImg = [self.liveOverlaysProject staticCGImageFor: frameMatchMillis]; if (baseOverlayImg != nil) { CGImageRetain( baseOverlayImg ); } } if (baseOverlayImg != nil) { CIImage *overCIImage = [[CIImage alloc] initWithCGImage: baseOverlayImg]; [self.mtkCompositingFilter0 setValue: overCIImage forKey: @"inputImage"]; [self.mtkCompositingFilter0 setValue: videoFrameImage forKey: @"inputBackgroundImage"]; frameCIImage = self.mtkCompositingFilter0.outputImage; CGImageRelease( baseOverlayImg ); baseOverlayImg = nil; } CIImage *CIImage_1 = nil; CIImage *CIImage_2 = nil; if (frameCIImage == nil) CIImage_1 = videoFrameImage; else CIImage_1 = frameCIImage; CGImageRef timeDependentImg = nil; @synchronized (self.liveOverlaysProject.liveImg_Lock) { timeDependentImg = [self.liveOverlaysProject liveCGImageFor: frameMatchMillis]; if (timeDependentImg != nil) { CGImageRetain( timeDependentImg ); } } if (timeDependentImg != nil) { CIImage *overCIImage = [[CIImage alloc] initWithCGImage: timeDependentImg]; [self.mtkCompositingFilter1 setValue: overCIImage forKey: @"inputImage"]; [self.mtkCompositingFilter1 setValue: CIImage_1 forKey: @"inputBackgroundImage"]; CIImage_2 = self.mtkCompositingFilter1.outputImage; CGImageRelease( timeDependentImg ); timeDependentImg = nil; } CIImage *finalCIImage = nil; if (CIImage_2 == nil) finalCIImage = CIImage_1; else finalCIImage = CIImage_2; CVPixelBufferRef outPixelBuf = NULL; if (self.cvBufferPool != NULL) error = CVPixelBufferPoolCreatePixelBufferWithAuxAttributes( kCFAllocatorDefault, self.cvBufferPool, NULL, &outPixelBuf ); if ((error != kCVReturnSuccess) || (outPixelBuf == NULL)) { OSType pixelFormatType = CVPixelBufferGetPixelFormatType( cvImageBuffer ); NSDictionary *pixelBufferAttributes = @{ (id) kCVPixelBufferIOSurfacePropertiesKey : @{} }; error = CVPixelBufferCreate( nil, CVPixelBufferGetWidth( cvImageBuffer ), CVPixelBufferGetHeight( cvImageBuffer ), pixelFormatType, (__bridge CFDictionaryRef) pixelBufferAttributes, &outPixelBuf ); } if ((error == kCVReturnSuccess) && (outPixelBuf != NULL)) { NSSet *commonKeys = [NSSet setWithArray:(NSArray *) CMVideoFormatDescriptionGetExtensionKeysCommonWithImageBuffers()]; NSDictionary *attachments = (NSDictionary *) CVBufferGetAttachments( cvImageBuffer, kCVAttachmentMode_ShouldPropagate ); [attachments enumerateKeysAndObjectsUsingBlock: ^(id key, id obj, BOOL *stop) { if ([commonKeys containsObject: key]) { CVBufferSetAttachment( outPixelBuf, (__bridge CFStringRef)(key), (__bridge CFTypeRef)(obj), kCVAttachmentMode_ShouldPropagate); } }]; attachments = (NSDictionary *) CVBufferGetAttachments( cvImageBuffer, kCVAttachmentMode_ShouldNotPropagate ); [attachments enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { if ([commonKeys containsObject: key]) { CVBufferSetAttachment( outPixelBuf, (__bridge CFStringRef)(key), (__bridge CFTypeRef)(obj), kCVAttachmentMode_ShouldNotPropagate); } }]; CVPixelBufferLockBaseAddress( outPixelBuf, 0 ); [self.videoCIContext render: finalCIImage toCVPixelBuffer: outPixelBuf bounds: [finalCIImage extent] colorSpace: self.deviceColorSpace]; CVPixelBufferUnlockBaseAddress( outPixelBuf, 0 ); } CMVideoFormatDescriptionRef videoInfo = NULL; OSStatus errStatus = CMVideoFormatDescriptionCreateForImageBuffer( kCFAllocatorDefault, outPixelBuf, &videoInfo ); if (errStatus == noErr) error = CMSampleBufferCreateReadyWithImageBuffer( kCFAllocatorDefault, outPixelBuf, videoInfo, &sampleTiming, &newSamplelBuf ); CVPixelBufferRelease( outPixelBuf ); CFRelease( videoInfo ); } } } return  newSamplelBuf; } The CIFilters are created once and reused for every sample buffer: self.mtkCompositingFilter0 = [CIFilter filterWithName: @"CISourceOverCompositing"]; self.mtkCompositingFilter1 = [CIFilter filterWithName: @"CISourceOverCompositing"]; The program works fine on most Macs (like iMacs, MacBook Pro, M1 Mini and more), but produces black frames on some machines. One example is a Mac mini (2018) 3.2GHz Core i7 with 6 cores and 16GB RAM, and another is a client's older MacBook Air. Running the app under Xcode on the Mini didn't produce any errors or warnings in the logs. Anyone has any pointers or ideas on how to fix this problem? Thank you.
Posted
by dareios.
Last updated
.
Post not yet marked as solved
1 Replies
315 Views
In my app I have a window that has a table view embedded in a split view with a 6 point space all around except at the bottom. The window displays ok when I build the app with Xcode 12.1. When I use Xcode 12.2 the space around the scrollview grows to 20 points. How can I fix this?
Posted
by dareios.
Last updated
.
Post marked as solved
6 Replies
1.2k Views
I am using AVFoundation to capture video from the built-in camera to an AVFragmentedAsset on disk. On a separate app I have an AVFragmentedAssetMinder that watches for changes in the asset duration and updates the AVPlayerItem of the AVPlayer. The code doing the update is: CMTime oldTime = self.player.currentItem.currentTime; float oldRate = self.player.rate; self.player.rate = 0.0; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset: fragAsset]; [self.player replaceCurrentItemWithPlayerItem: playerItem]; [self.player seekToTime: oldTime toleranceBefore: kCMTimeZero toleranceAfter: kCMTimeZero]; self.player.rate = oldRate; The problem with that approach is that I get flashes when updating, which is very annoying. Is there any other way to update the playing AVPlayerItem? I am using the latest macOS and Xcode.
Posted
by dareios.
Last updated
.
Post marked as solved
3 Replies
445 Views
I am running on a MacBook with macOS Catalina 10.15.6 &amp; Xcode 11.6 I am capturing video &amp; audio from the built-in camera and writing them to a QuickTime movie file on disk using an AVAssetWriter created like this: self.myVideoWriter = [[AVAssetWriter alloc] initWithURL: targetURL fileType: self.myCaptureFileType error: &amp;err]; self.myVideoWriter.movieFragmentInterval = CMTimeMake( 5, 1 ); The movie file is written ok and I can open and playback the resulting .mov file with other video apps during the capture. The problem is I cannot get any AVAssetDurationDidChangeNotifications in my program. After the AVAssetWriter starts writing to disk, I create an AVFragmentedAsset for the targetURL above and I create an AVFragmentedAssetMinder for the asset like this: AVFragmentedAsset *theAsset = [[AVFragmentedAsset alloc] initWithURL: targetURL options: @{ AVURLAssetPreferPreciseDurationAndTimingKey : @(YES) }]; self.fragmentedAssetMinder = [[AVFragmentedAssetMinder alloc] initWithAsset: theAsset mindingInterval: 5]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(durationChanged:) name: AVAssetDurationDidChangeNotification object: nil]; The problem is that the durationChanged: notification handler is never called. Any ideas what am I doing wrong?
Posted
by dareios.
Last updated
.
Post not yet marked as solved
1 Replies
560 Views
Hello and a happy New Year,In our apps we have a custom-made movie controller view. From there we use the AVPlayer method seekToTime: (CMTime)time to jump to specific positions in a movie displayed in a AVPlayerView.The following series of actions results in wrong behavior:1) Use seekToTime: to jump to a position in the movie asset (from a button or a menu item).2) Try to use the mouse scroll-wheel over the AVPlayerView to scroll the video content forward or backward.The video position jumps to start (time 0) and scrolls from there, instead of scrolling around the programmatically set position in step (1).The problem occurs only if the first user action is scrollToTime, followed by using the scroll-wheel. Changing the sequence of actions, or after getting the wrong behavior the first time, things behave as expected.Is there any way around this very annoying problem?Christos KonidarisP.S. Also submitted as problem FB7506896.
Posted
by dareios.
Last updated
.