问题
Is there some kind of magic required to get ptr.get()
to work? For some reason the following code always crashes my app:
AudioStreamBasicDescription asbd = new AudioStreamBasicDescription(mSampleRate, mFormatID, mFormatFlags, mBytesPerPacket, mFramesPerPacket, mBytesPerFrame, mChannelsPerFrame, mBitsPerChannel, 0);
AudioFilePtr outAudioFile = new AudioFilePtr();
File f = File.createTempFile("ptt", ".caf");
AudioFileError afe = AudioFile.createWithURL(new NSURL(f), 1667327590, asbd, 1, outAudioFile);
System.out.println(afe.name());
System.out.println(outAudioFile.get());
It successfully returns from AudioFile.createWithURL
with no errors (error code: No), but crashes as soon as I try to get the java instance. I'm also experiencing the same type of crash in another section of code where I instantiate an AudioQueuePtr as queueptr
, pass it in to AudioQueue.newInput
and try to call queueptr.get()
. Is there something I'm missing here?
There's no stack trace in java, but here's the XCode Organizer Device Log:
Incident Identifier: 2EEFF4F0-9031-4798-80E7-69F55BB70576
CrashReporter Key: 08d7c27d21cb15553295bbae1b2aa2040e94b517
Hardware Model: iPhone3,1
Process: iOS_RVM_NN [1972]
Path: /var/mobile/Applications/B2571332-7C2F-4A5A-8932-8BF5EC94EE33/iOS_RVM_NN.app/iOS_RVM_NN
Identifier: iOS_RVM_NN
Version: 1 (1.0)
Code Type: ARM (Native)
Parent Process: debugserver [1971]
Date/Time: 2014-12-02 11:22:50.710 -0500
OS Version: iOS 7.1.2 (11D257)
Report Version: 104
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x39838a58 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x39838854 mach_msg + 44
2 CoreFoundation 0x2eaa2846 __CFRunLoopServiceMachPort + 150
3 CoreFoundation 0x2eaa0fb2 __CFRunLoopRun + 850
4 CoreFoundation 0x2ea0beba CFRunLoopRunSpecific + 518
5 CoreFoundation 0x2ea0bc9e CFRunLoopRunInMode + 102
6 GraphicsServices 0x3391165e GSEventRunModal + 134
7 UIKit 0x31358148 UIApplicationMain + 1132
8 iOS_RVM_NN 0x007b024e 0x8c000 + 7488078
9 iOS_RVM_NN 0x007af7e2 0x8c000 + 7485410
10 iOS_RVM_NN 0x007af822 0x8c000 + 7485474
11 iOS_RVM_NN 0x00344afe 0x8c000 + 2853630
12 iOS_RVM_NN 0x00953ca0 0x8c000 + 9206944
13 iOS_RVM_NN 0x0094cbfa 0x8c000 + 9178106
14 iOS_RVM_NN 0x0094e876 0x8c000 + 9185398
15 iOS_RVM_NN 0x0094e8d0 0x8c000 + 9185488
16 iOS_RVM_NN 0x00948ce6 0x8c000 + 9161958
17 iOS_RVM_NN 0x009417ae 0x8c000 + 9131950
18 iOS_RVM_NN 0x00212f84 0x8c000 + 1601412
回答1:
Turns out this was a bug in the RoboVM bindings. Should be fixed in future releases. View the bug report here: https://github.com/robovm/robovm/issues/627
Also, I posted a full working example here: RoboVM implementation of recording demo using AudioQueue results in "No @Marshaler found" error
来源:https://stackoverflow.com/questions/27239166/robovm-app-crashes-on-ptr-get