Bug 19511 - Incorrect argument for GKTurnBasedEventHandlerDelegate.HandleInviteFromGameCenter
Summary: Incorrect argument for GKTurnBasedEventHandlerDelegate.HandleInviteFromGameCe...
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-05-03 17:32 UTC by Eric Smith
Modified: 2014-06-02 14:33 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Eric Smith 2014-05-03 17:32:29 UTC
The method is declared as HandleInviteFromGameCenter(GKPlayer[]).  However the iOS documentation states that the argument is an NSArray of NSStrings.  Whenever Game Center calls this method, my app will fail, trying to cast an NSString to a GKPlayer.
Comment 1 Sebastien Pouliot 2014-05-03 21:24:05 UTC
You're right, it is a binding error [1].

The workaround is to create a weak delegate (i.e. assign GKTurnBasedEventHandler.WeakDelegate instead of GKTurnBasedEventHandler.Delegate) that exports the required methods (with the right signatures). That will allow the ObjC runtime to call your method (without a cast exception).

[1] https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKTurnBasedEventHandlerDelegate_Ref/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/intfm/GKTurnBasedEventHandlerDelegate/handleInviteFromGameCenter:

Fixed in master c684da63a9f30dcdcdec8e74db8c8a3174c6816c
Comment 2 Akhilesh kumar 2014-06-02 14:33:10 UTC
I have checked this issue with following builds:

XS 5.1 (build 307)
X.iOS 7.2.99.420

I have checked 'HandleInviteFromGameCenter()' method in assembly browser where I got two HandleInviteFromGameCenter() method with following argument:

HandleInviteFromGameCenter (NSString[] playersToInvite) and HandleInviteFromGameCenter (GKPlayer[] playersToInvite)

Screencast: http://screencast.com/t/ZKllBndkavuE

hence, closing this issue.