Forum Xamarin.iOS

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?

Posts

  • DanielCentoreDanielCentore USMember

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

    [CompilerGenerated]
    public static MPNowPlayingInfoCenter DefaultCenter {
    [Export ("defaultCenter")]
    get;
    }

    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

    Bump

  • 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.