Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xcode12][mediaplayer] Fix MPMusicPlayerController NowPlayingItem on recent iOS versions #9619

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

spouliot
Copy link
Contributor

Rolf nailed the issue in #9578 (comment)

The problem is that iOS returns an instance of a private type (_MPMusicPlayerMediaItemProxy) which is an NSProxy subclass, and currently we don't support NSProxy.

rolfbjarne@873a1e1 was on the
right track but it turns out [ForcedType] on properties don't need, nor
work (same generated code), with return:.

Inside DynamicRegistrar.cs the method

public Type Lookup (IntPtr @class, bool throw_on_error)

did not respect (was unused) the throw_on_error. That made it
impossible to force the type to the pointer we got.

In Runtime.cs the method LookupINativeObjectImplementation must also
be able to work without an exception (from the Lookup) at least when we
want to force the type.

backport of #9604
reference: #9578

…recent iOS versions

Rolf nailed the issue in xamarin#9578 (comment)
> The problem is that iOS returns an instance of a private type (_MPMusicPlayerMediaItemProxy) which is an NSProxy subclass, and currently we don't support NSProxy.

rolfbjarne@873a1e1 was on the
right track but it turns out `[ForcedType]` on properties don't need, nor
work (same generated code), with `return:`.

Inside `DynamicRegistrar.cs` the method
```csharp
public Type Lookup (IntPtr @Class, bool throw_on_error)
```
did not respect (was unused) the `throw_on_error`. That made it
impossible to force the type to the pointer we got.

In `Runtime.cs` the method `LookupINativeObjectImplementation` must also
be able to work without an exception (from the `Lookup`) at least when we
want to force the type.

backport of xamarin#9604
reference: xamarin#9578
@spouliot spouliot added the bug If an issue is a bug or a pull request a bug fix label Sep 10, 2020
@spouliot spouliot added this to the xcode12 milestone Sep 10, 2020
@monojenkins
Copy link
Collaborator

Build success
Build succeeded
API Diff (from stable)
API Diff (from PR only) (no change)
ℹ️ Generator Diff (please review changes)
Test run succeeded

@spouliot spouliot merged commit c91b451 into xamarin:xcode12 Sep 10, 2020
@spouliot spouliot deleted the xcode12-backport-gh9604 branch September 10, 2020 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants