2015-09-12 107 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