2015-09-12 87 views
0

我已经写了流媒体音频的钛iOS模块。 在iPhone 5s及以上的应用程序和模块运行良好。Xcode AVPlayer崩溃iPhone 5 - 钛iOS模块

问题是每当我的应用程序在iPhone 5中调用stopStream函数或降低应用程序崩溃时。

我认为有内存泄漏或者其他东西,但我没有找到解决这个问题。

这里是我的模块代码:

//这个函数THET开始流。是没有问题的ON THE IPHONE 5

-(id)startStream:(id)args 
{ 
    ENSURE_SINGLE_ARG(args,NSString); 

    NSURL *url = [NSURL URLWithString:args]; 

    playerItem = [AVPlayerItem playerItemWithURL:url]; 

    [playerItem addObserver:self forKeyPath:@"timedMetadata" options:NSKeyValueObservingOptionNew context:nil]; 

    player = [[AVPlayer playerWithPlayerItem:playerItem] retain]; 
    [player addObserver:self forKeyPath:@"status" options:0 context:nil]; 
    [player play]; 

    [self fireEvent:@"START" withObject:nil]; 

    NSLog(@"[INFO] player item error : %@", playerItem.error.description); 
    NSLog(@"[INFO] player error : %@", player.error.description); 

    return args; 
} 

//这是函数WHERE MY APP CRASH ON IPHONE 5

-(id)stopStream:(id)args 
{ 
    NSLog(@"[INFO]AVPlayer STOP"); 
    [player pause]; 
    [playerItem removeObserver:self forKeyPath:@"timedMetadata" context:nil]; 
    [player removeObserver:self forKeyPath:@"status" context:nil]; 

    player=nil; 
} 

这里该装置日志的一个组成部分。

296 00:43:40 W TestApp[3487] <Warning>: [INFO]AVPlayer STOP 
297 00:43:40 E ReportCrash[3490] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument) 
301 00:43:40 W mediaserverd[37] <Warning>: 00:43:40.969 [0x3257000] CMSession retain count > 1! 
306 00:43:41 W SpringBoard[43] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application. 
307 00:43:41 W SpringBoard[43] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application. 
308 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3483: No such process 
309 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process 
310 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process 
311 00:43:41 W SpringBoard[43] <Warning>: Unable to get short BSD proc info for 3487: No such process 
312 00:43:41 E ReportCrash[3490] <Error>: Not saving crash log because we have reached the limit for logs to store on disk. Sync or otherwise clear logs from /var/mobile/Library/Logs/CrashReporter to save new logs. 
313 00:43:41 E ReportCrash[3490] <Error>: Could not save crash report to disk! 
314 00:43:41 W SpringBoard[43] <Warning>: Application 'UIKitApplication:com.fpmsoft.isa.TestApp[0x476c]' crashed. 
315 00:43:41 W assertiond[58] <Warning>: pid_suspend failed for <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1>: Unknown error: -1, Unknown error: -1 
316 00:43:41 W assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1> to 2, priority: No such process 
317 00:43:41 W assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x14d90e90; com.fpmsoft.isa.TestApp; pid: 3487; hostpid: -1> to 4096, priority: No such process 
318 00:43:41 W UserEventAgent[17] <Warning>: id=com.fpmsoft.isa.TestApp pid=3487, state=0 
319 00:43:41 E ReportCrash[3490] <Error>: Incident Identifier: 5CF594F7-3628-4EAE-88D6-B6AA4DC4C028 
320 00:43:41 E ReportCrash[3490] <Error>: CrashReporter Key: 509d7f4d78bbd031f5bf1a6ef122f14f5be24f8b 
321 00:43:41 E ReportCrash[3490] <Error>: Hardware Model:  iPhone5,2 
322 00:43:41 E ReportCrash[3490] <Error>: Process:    TestApp [3487] 
323 00:43:41 E ReportCrash[3490] <Error>: Path:    /private/var/mobile/Containers/Bundle/Application/78A7A4DB-3377-4875-B86F-217F1B8DFF9E/TestApp.app/TestApp 
324 00:43:41 E ReportCrash[3490] <Error>: Identifier:   TestApp 
325 00:43:41 E ReportCrash[3490] <Error>: Version:    ??? 
326 00:43:41 E ReportCrash[3490] <Error>: Code Type:   ARM (Native) 
327 00:43:41 E ReportCrash[3490] <Error>: Parent Process:  launchd [1] 
328 00:43:41 E ReportCrash[3490] <Error>: Date/Time:   2015-09-13 00:43:40.855 +0200 
329 00:43:41 E ReportCrash[3490] <Error>: Launch Time:   2015-09-13 00:43:34.825 +0200 
330 00:43:41 E ReportCrash[3490] <Error>: OS Version:   iOS 8.3 (12F70) 
331 00:43:41 E ReportCrash[3490] <Error>: Report Version:  105 
332 00:43:41 E ReportCrash[3490] <Error>: Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
333 00:43:41 E ReportCrash[3490] <Error>: Exception Subtype: KERN_INVALID_ADDRESS at 0x9805ac14 
334 00:43:41 E ReportCrash[3490] <Error>: Triggered by Thread: 6 
335 00:43:41 E ReportCrash[3490] <Error>: Thread 0 name: Dispatch queue: com.apple.main-thread 
336 00:43:41 E ReportCrash[3490] <Error>: Thread 0: 
337 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib   0x359b1474 0x359b0000 + 5236 
338 00:43:41 E ReportCrash[3490] <Error>: 1 libsystem_kernel.dylib   0x359b1268 0x359b0000 + 4712 
339 00:43:41 E ReportCrash[3490] <Error>: 2 CoreFoundation     0x2708256e 0x26fb5000 + 841070 
340 00:43:41 E ReportCrash[3490] <Error>: 3 CoreFoundation     0x27080b14 0x26fb5000 + 834324 
341 00:43:41 E ReportCrash[3490] <Error>: 4 CoreFoundation     0x26fcd1fc 0x26fb5000 + 98812 
342 00:43:41 E ReportCrash[3490] <Error>: 5 CoreFoundation     0x26fcd00e 0x26fb5000 + 98318 
343 00:43:41 E ReportCrash[3490] <Error>: 6 GraphicsServices    0x2e8ac1fc 0x2e8a3000 + 37372 
344 00:43:41 E ReportCrash[3490] <Error>: 7 UIKit       0x2a771a54 0x2a702000 + 457300 
345 00:43:41 E ReportCrash[3490] <Error>: 8 TestApp       0x00024ca2 0x20000 + 19618 
346 00:43:41 E ReportCrash[3490] <Error>: 9 libdyld.dylib     0x358faaac 0x358f9000 + 6828 
347 00:43:41 E ReportCrash[3490] <Error>: Thread 1 name: Dispatch queue: com.apple.libdispatch-manager 
348 00:43:41 E ReportCrash[3490] <Error>: Thread 1: 
349 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib   0x359b1224 0x359b0000 + 4644 
350 00:43:41 E ReportCrash[3490] <Error>: 1 libdispatch.dylib    0x358e60ec 0x358d8000 + 57580 
351 00:43:41 E ReportCrash[3490] <Error>: 2 libdispatch.dylib    0x358dad36 0x358d8000 + 11574 
352 00:43:41 E ReportCrash[3490] <Error>: Thread 2 name: Dispatch queue: com.appcelerator.anlaytics.databaseQueue 
353 00:43:41 E ReportCrash[3490] <Error>: Thread 2: 
354 00:43:41 E ReportCrash[3490] <Error>: 0 libsystem_kernel.dylib   0x359b14c4 0x359b0000 + 5316 
355 00:43:41 E ReportCrash[3490] <Error>: 1 libdispatch.dylib    0x358e45da 0x358d8000 + 50650 
356 00:43:41 E ReportCrash[3490] <Error>: 2 CFNetwork      0x26b50c6c 0x26aef000 + 400492 
357 00:43:41 E ReportCrash[3490] <Error>: 3 CFNetwork      0x26b6bd3a 0x26aef000 + 511290 
358 00:43:41 E ReportCrash[3490] <Error>: 4 TestApp       0x00374bbc 0x20000 + 3492796 
359 00:43:41 E ReportCrash[3490] <Error>: 5 TestApp       0x0036c1d2 0x20000 + 3457490 
360 00:43:41 E ReportCrash[3490] <Error>: 6 libdispatch.dylib    0x358e0a38 0x358d8000 + 35384 
361 00:43:41 E ReportCrash[3490] <Error>: 7 TestApp       0x0036bdaa 0x20000 + 3456426 
362 00:43:41 E ReportCrash[3490] <Error>: 8 libdispatch.dylib    0x358d92cc 0x358d8000 + 4812 
+0

当您发布关于崩溃的问题时,您必须提供有关崩溃的详细信息。什么是完整的和确切的错误信息,以及哪条线正在导致崩溃? – rmaddy

+0

这是我的大问题。在每个模拟器中,应用程序运行都没有问题。只有在真正的iPhone 5设备上,应用程序崩溃。 目前,我不能在真正的iPhone 5上测试它,我可以连接到我的Mac。我只能让其他人测试应用程序时,我建立它或测试它在这里testobject.com。 这就是为什么我没有日志或错误消息 – tablesuplex

+0

您可以从测试用户获得崩溃报告。他们需要使用iTunes将他们的设备同步到他们的电脑。然后,崩溃报告将在他们的电脑上。 – rmaddy

回答

0

我找到了我的问题的解决方案。 我必须在函数中添加一个返回值。 现在它适用于iPhone5和更低版本

-(id)stopStream:(id)args 
{ 
    NSLog(@"[INFO]AVPlayer STOP"); 
    [player pause]; 

    [playerItem removeObserver:self forKeyPath:@"timedMetadata" context:nil]; 
    [player removeObserver:self forKeyPath:@"status" context:nil]; 

    return args; 
} 
0

你也超过了保留球员。您应该在您的stopStreamstartStream[player release];,如果尚不存在,只实例化新的player