CarPlay MPPlayableContentManager does not call delegate

A CarPlay app that I am working on has developed the symptom that the MPPlayableContentManager never calls any of the MPPlayableContentDelegate methods, at least in the simulator. It seems most likely that this is due to some change in the tooling, as the delegate was working previously, and older versions of the app now fail. Here are some details:


Initialization, in my AppDelegate.m


    MYContentDataSource *contentDataSource = [MYContentDataSource sharedInstance];
    MYContentDelegate *contentDelegate = [[MYContentDelegate alloc] init];
    MPPlayableContentManager *contentManager = [MPPlayableContentManager sharedContentManager];
    contentManager.dataSource = contentDataSource;
    contentManager.delegate = contentDelegate;


Here is my .entitlements file:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>com.apple.developer.playable-content</key>
  <true/>
</dict>
</plist>


I am using a development certificate with the com.apple.developer.playable-content entitlement.


The MPPlayableContentDataSource works as expected, but none of the delegate methods are called, and no errors are generated. Any help would be appreciated, as I have been banging my head against a wall on this one for quite a while.

Replies

It turns out that `MPPlayableContentManager` only retains a weak reference to the content delegate. In doing some cleanup, I had inadvertently removed the strong reference that keep the object from being released. Restoring the strong reference caused the object to be retained and fixed the problem.