AVAssetExportSession exportSessionWithAsset:presetName: failing on iPad Pro Simulator - ios

On the Xcode 7.1.1 iPad Pro simulator, the following AVAssetExportSession method returns nil, given a valid AVAsset:
AVAssetExportSession *exportSession = [AVAssetExportSession exportSessionWithAsset:avAsset presetName:AVAssetExportPresetAppleM4A];
This method always succeeds for me on other iOS 8 and 9 devices and simulators.
I don't have an actual iPad Pro, so I'm not sure whether this is specific to the iPad Pro simulator.
Does anyone have any info on this? (I use AVAssetExportSession to trim the ends of audio files.)
Also, is there a way to query for the error associated with a failure for this method (since it doesn't return an error code)?
Here is a link to my sample Xcode project, stored on Dropbox. If anyone has an actual iPad Pro device, could you try running this? In the onExportAudio: method, could you see whether exportSession gets set to nil? (There's also an audio trimming method that gets called if exportSession is valid...I would be curious if the trimming code successfully trims the 4 second source audio file into a 2 second destination audio file.) ... https://www.dropbox.com/s/zy2qpx94h2pltpi/AudioExportTest_711.zip?dl=0
Thank you!
-Allan

I tried reproducing this issue on a real iPad Pro today, and the issue did not occur.
It appears to be Simulator-specific.
-Allan

Related

CVBuffer is nil in call back of h264 decoder

When i try to decode the raw h264 stream , CVBuffer gives me nil on callback, and this only happen on the real device(iPhone , iPad) and not on the simulator.
Any suggestions?!
Found this ffmpeg ticket, which, after debugging, seems to be caused by the same issue (nil CVBuffer, status -12909) - https://trac.ffmpeg.org/ticket/9016#trac-add-comment
So far no resolution -- and the same code works on Intel Macos (broken on M1). It is broken across both iPhone and iPad with iOS 15, but the same code worked on the same devices with iOS 14.x.
P.S. Also https://trac.ffmpeg.org/ticket/9713

AVPlayer unable to play video from NSDocuments Directory on iOS8

I'm trying to get my app to play a video that has been downloaded to the Documents Directory.
My code works when tested on the iOS 7.1 simulator but not on iOS 8.0 devices or the iOS 8.0 simulator. There isn't any error, AVPlayer does not play the video and shows a Black View.
I also checked the Document's folder of my device with XCode's Organizer and the file appears to be successfully downloaded.
Here is a simplified version of my code.
// file_path is a string that stores the path to the video file a println of it shows
// "/var/mobile/Containers/Data/Application/83C7837C-59B5-4767-A579-7CE758A93C6F/Documents/og4gr.mp4"
var path:NSURL = NSURL.fileURLWithPath(file_path, isDirectory: false);
_player = AVPlayer(URL: path);
Has anyone else encountered this? Thank you for your time!
So the problem was that the Application Documents Folder Path changes every time you launch the app and I was storing the absolute path of the video file.
According to this article here:
http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/, this is how it is now in iOS 8, which is why while my method worked in iOS7 it was failing on iOS8 devices and Simulators. Thank you #RoboticCat for pointing me in the right direction!

UIImagePickerController: "choose/play" a video from the library does not work on iPhone Simulator

I am working on an iPhone APP and testing it on the iPhone simulator/Xcode. I have a problem: UIImagePickerController: "choose/play" a video from the library does not work on the Simulator (but it works on the real phone). How to solve this problem? Thanks for help.
Check if the error: "Error creating aggregate audio device" occurs where the NSLogs are printed. If so, the fix is in the following thread:
UIImagePickerController throws ERROR: 185: Error creating aggregate audio device: 'what' when trying to select video

CGPDFDocumentCreateWithURL(filePath) returns null on device, but not on simulator

I'm using following line to create a PDF reference:
CGPDFDocumentRef thePDFDocRef = CGPDFDocumentCreateWithURL(filePath);
On my simulator, this is working.
But when I deploy this to my device, the call returns "null"
The filePath is exactly the same.
As a test, I'm also printing if the filePath (PDF) exists and it does.
I also checked for case sensitive things.
My device is running iOS 6.1.2 and I'm testing with Simulator 6.0.
Any ideas?

Fresh SpeakHere example app has error when recording audio in Simulator/Xcode

I can't record audio using the SpeakHere example app from apple. When I run the app in Simulator from within Xcode, it starts up normally, but when I press the record button, the error "Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)" occurs:
The log message about the missing root view controller at app startup is already there BEFORE the above error occurs and it is probably not connected to my problem.
I have downloaded the SpeakHere example project from the linked website (see top of this question), opened the fresh download in Xcode and directly started the app. I did not modify any setting and not any line of code. I've also searched on google and stackoverflow for this problem and didn't find a solution, although this problem must be very general.
I use Xcode Version 4.5.2 (4G2008a) and a MacBook Pro from late 2009 with Mac OS X 10.8.
I've also had a friend try this on his computer and he has the very same problem. He has the same OS and his XCode version is also 4.5.2.
I would now try older Xcode versions, but right now I don't like to download a few gigabytes for a trial'n'error approach on my connection.
Any help appreciated, including reports like "works for me with Xcode version ...". Thanks!
The problem occurs because in the method AQRecorder::StartRecord(CFStringRef inRecordFile), the function CFURLCreateWithString() fails and returns a pointer to nil. This is not detected and later on the code calls CFRelease() on this nil pointer, which causes the EXC_BREAKPOINT.
The purpose of the method CFURLCreateWithString() basically is to take a url string as input and return a pointer to a CFURL object as output. The problem here is that the input is not a url string. Instead, it's simply a path on the local file system without file:/ or the like as prefix. For this reason, this method fails.
The solution is to remove the not-working call to the method CFURLCreateWithString() and instead call a related method, namely CFURLCreateWithFileSystemPath(), which is prepared to take a local file system path and convert it to a CFURL:
In the method AQRecorder::StartRecord(CFStringRef inRecordFile), replace or comment out the line
url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)recordFile, NULL);
and insert
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)recordFile, kCFURLPOSIXPathStyle, false);
at its place.
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef)recordFile, kCFURLPOSIXPathStyle, false);
The code above made my xcoce 4.6 compile and run in simulator, but it doesnot record my voice from my usb microphone, I test my microphone in the garash band application and sucessfully record and play my voice, and the dbmeter does not move at all, any way when I port it to the real device it work, it just can't record and play voice in my simulator.

Resources