Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

MPNowPlayingInfoCenter.DefaultCenter null in latest iOS

DanielCentoreDanielCentore USMember
edited April 2017 in Xamarin.iOS

MPNowPlayingInfoCenter.DefaultCenter seems to be null when running an app in the simulator (iOS 10.3) but not on a physical device (iOS 9.3.5).

Is there something I might be doing wrong to cause this?


  • DanielCentoreDanielCentore USMember

    After investigating some more, I've discovered that MPNowPlayingInfoCenter in the AssemblyBrowser houses the following:

    public static MPNowPlayingInfoCenter DefaultCenter {
    [Export ("defaultCenter")]

    However, in the latest version of iOS, "defaultCenter" has been renamed to "default". So I'm going to guess that it's an iOS version difference, although I have no way of checking that this is the case.

    Is there perhaps some workaround I could try?

  • DanielCentoreDanielCentore USMember


  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    I do not see that renaming in the iOS framework. I note that in Swift there is a method default on the type MPNowPlayingInfoCenter to get the default info center, but in Obj-C it is still a field called defaultCenter. So I have no idea why that is returning null for you. I just did a quick test and an MPNowPlayingInfoCenter object was returned on both a device (10.3.1) and simulators (10.3 and 9.3).

    Can you share some sample code that is not working on the simulator?

  • DanielCentoreDanielCentore USMember

    I apologise; For some reason deleting and re-cloning the project caused it to no longer be null, so something very odd must have been going on. Even a clean in the original project did not solve it, and I am on the exact same commit. Regardless, I suppose this is invalid.

Sign In or Register to comment.