140

I am playing video from a controller like this:

func playMovie() {
    let path = Bundle.main.path(forResource: "xyz", ofType:"mov")
    let url = URL(fileURLWithPath: path!)

    self.player = AVPlayer(url: url)
    let layer: AVPlayerLayer = AVPlayerLayer(player: self.player)

    layer.frame = self.view.frame
    layer.videoGravity = AVLayerVideoGravityResizeAspectFill
    self.view.layer.addSublayer(layer)

    self.player.play()
}

Even after the controller is destroyed and no longer in use, I get this log message every second or so:

AQDefaultDevice (173): skipping input stream 0 0 0x0

I am not asking how to hide these logs. I know how to do that by setting OS_ACTIVITY_MODE to disable (See this for how to hide these logs). My concern is that the movie may be still playing somehow even after the controller is destroyed. Is there anything wrong in the way I am playing the movie. Or do I need to perform any additional cleanup?

Community
  • 1
  • 1
RajV
  • 6,860
  • 8
  • 44
  • 62
  • I guess this answer will fits you. It explains a way to remove the log with more details. http://stackoverflow.com/a/40336926/4602597 – MessuKilkain Nov 10 '16 at 10:59
  • 7
    My question was not about how to hide unwanted logs. I have made that clear in the last paragraph. My question was if that particular log was pointing to an unreleased resource related to the AVPlayer. – RajV Feb 09 '17 at 03:46
  • Possible duplicate of [Hide strange unwanted Xcode 8 logs](http://stackoverflow.com/questions/37800790/hide-strange-unwanted-xcode-8-logs) – Alex Hall Mar 23 '17 at 02:15
  • The only reason I found this question (and the solution linked in comments to it) is to disable this annoying aspect of the log re a multimedia player object, as it interferes with reading other logs; FWIW. But yeah, apparently you're doing things right and the log isn't behaving as it ought. – Alex Hall Mar 23 '17 at 02:18
  • This is so annoying. I spent hours trying to determine why the player wasn't stopping and now -- as far as I can tell -- it's an XCode bug. Did you ever find any other answer @RajV? – David Vincent Gagne Apr 04 '17 at 18:24

3 Answers3

100

No, you do nothing wrong. This is a bug with logs in Xcode8 + iOS10.


We can get round it in this way (device and simulator need different values):

Add the Name OS_ACTIVITY_MODE and the Value ${DEBUG_ACTIVITY_MODE} and check it (in Product -> Scheme -> Edit Scheme -> Run -> Arguments -> Environment).

enter image description here

Add User-Defined Setting DEBUG_ACTIVITY_MODE, then add Any iOS Simulator SDK for Debug and set it's value to disable (in Project -> Build settings -> + -> User-Defined Setting)

enter image description here

Igor
  • 12,165
  • 4
  • 57
  • 73
  • 8
    Did you read my question? I have already said I can disable logging using OS_ACTIVITY_MODE. That is not the point of this question. – RajV Nov 22 '16 at 15:34
  • This is a bug with logs in Xcode8 + iOS10. - this is an answer to your question. – Igor Nov 22 '16 at 15:41
  • The question I asked is not about how to hide these log messages. It was, and I quote, "Is there anything wrong in the way I am playing the movie. Or do I need to perform any cleanup?" – RajV Nov 23 '16 at 16:24
  • Changed to "No you do nothing wrong. This is a bug with logs in Xcode8 + iOS10." – Igor Nov 23 '16 at 16:30
  • 22
    A "solution" that requires me to change an environment variable by hand, every time I switch from running in the Simulator to running on a device, is no solution at all. – matt Nov 25 '16 at 19:39
  • 14
    If you'll find better solution, please, tell us. – Igor Nov 25 '16 at 19:56
  • Informative Igor, but like RajV says, it's not a solution as it does just as much harm as it does good. Now if there was a way to only remove a log that looks like that, that would work, but removing all logs isn't very helpful. – Kjell Nov 26 '16 at 15:35
  • This solution doesn't remove all logs, but only this extra strange logs. – Igor Nov 26 '16 at 15:39
  • Thanks. This is a great write up of an obscure feature/bug in Xcode. – John Fricker Sep 04 '17 at 18:03
68

I got this problem when i using AVPlayer Foundation on iOS Simulator (xcode 8.1).However it doesn't log anymore on iOS devices. In my opinion it's a log bug.The player or the layer is destroyed.


update

i got this for you fix unwanted log messages

Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
OmniBug
  • 892
  • 8
  • 12
0

Not really an answer, but more of a clue that might help somebody debug this...

I started getting this warning as soon as I removed the AVFoundation framework from my Xcode 9/iOS 11 project. I am using AVFoundation (specifically AVPlayer and AVPlayerLayer), but it still ran and compiled fine after removing the framework from the target's Linked Frameworks and Libraries editor, and then removing it from the Frameworks folder (I was trying to eliminate a different runtime warning).

Adding it back in via the Linked Frameworks and Libraries editor eliminated the runtime warnings in the console.

Dave Batton
  • 8,795
  • 1
  • 46
  • 50