iOS和游戏中心-为托管游戏挑选朋友
【腾讯云】亏本大甩卖,服务器4核16G 1年370元(带宽12M,系统盘120GB SSD盘,月流量2000GB)!!!!!!
云产品 配置 价格
服务器 1核2G,带宽5M,系统盘50GB SSD盘,月流量500GB 38元/年
MySQL 1核1G 19元/年
服务器 16核32G,带宽18M,系统盘250GB SSD盘,月流量5000GB 1197元/年
点我进入腾讯云,查看更多详情

I'm experimenting with adding Game Center support to our game. It already has OpenFeint support but we'd also want to support GC.

The basic authentication and usage is quite easy and seems to work quite well (apart from that the sandbox is terribly unstable). However, due to our architecture we would like to use GC mainly for picking friends, not using the full invitation support. So, I'm looking for a way to use something like GKMatchmakerViewController to only pick friends, not send invites to them. I'd like to show the normal view where the player can select the friends and then just return the picked friends, I don't want the view/GC to send anything at all to the picked friends.

    GKMatchmakerViewController * mmvc = [[[GKMatchmakerViewController alloc] initWithMatchRequest:request] autorelease];
    mmvc.matchmakerDelegate = my_delegate;
    mmvc.hosted = YES;

This should according to the docs call my delegate's didFindPlayers method, but it doesn't seem to work. The hosted flag has no effect, both with and without it GC seems to try to send something to the picked friend(s) and then briefly shows a text Incompatible in the UI and and disregard the picked friend.

Do I do something fundamentally wrong here or is what I want to do just not possible? What does the Incompatible error actually mean? I'm running between two iPads that both have sandboxed users logged in. Is picking friends without notifying them actually possible?

Edit:

The Incompatible message that the GKMatchmakerViewController shows when I try to pick friends is weird. I have not found any documentation as to what it might mean and what could cause it. A simple guess is that GC somehow thinks that the sandboxed users have different versions of my game installed and these are somehow not compatible. This game is already available in the app store, but without GC networking. Could the sandbox environment somehow pick up some information from that? No old version of the game is installed on the pads though.

#0

To those who still experience this issue. Take a look at your build phases, Run Script section. In my case I used one of these scripts that automatically increases build number, its a common practice to keep track of such things. But, Game Center will not get along with this approach. The script actually takes CFBundleVersion and increases it by 1 (there are various techniques, the one I use just does +1).

#!/bin/bash
buildPlist=${INFOPLIST_FILE}
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
CFBundleVersion=$(($CFBundleVersion + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" $buildPlist

So I install build on iPhone, it's build number is, say, 295, then I install it on iPad and it has 296 build version, which is same as bundle version. And the two versions are incompatible from Game Center's point of view.

The normal (instant) multiplayer mode just says "Incompatible" when trying to invite a friend. Turn-Based mode will not show anything useful at all.

The whole thing is confusing, since on iTunesConnect in Game Center compatibility list it shows short versions strings (CFBundleShortVersionString), so I assumed as soon as I put same value in "Version" field of project settings, it will work. It doesn't though, the "Build" must be same as well.

#1

I can confirm that the CFBundleVersion in the Info.plist must match exactly. I had one device with version "4.00" and the other one at "4.0", and I was getting the 'Incompatible' message. Changing them both to "4.00" resolved the issue.

推荐文章

使用nodejs php和mysql的安全websocket

使用nodejs php和mysql的安全websocket

推荐文章

如何选中至少一个复选框?

如何选中至少一个复选框?

推荐文章

如何在中构建实时系统asp.net?

如何在中构建实时系统asp.net?

推荐文章

传球@网址.内容ASP MVC中的as参数

传球@网址.内容ASP MVC中的as参数

推荐文章

p12文件未连接到分发证书

p12文件未连接到分发证书

推荐文章

Android:ConnectivityManager始终返回null

Android:ConnectivityManager始终返回null

推荐文章

让Django在一个虚拟的虚拟环境中运行,让他通过Upstart

让Django在一个虚拟的虚拟环境中运行,让他通过Upstart

推荐文章

日蚀.ini文件和选项

日蚀.ini文件和选项

推荐文章

在服务器上运行游戏逻辑的快速方法

在服务器上运行游戏逻辑的快速方法

推荐文章

django cms apphook与相对URL

django cms apphook与相对URL

推荐文章

SQL表/子查询别名约定

SQL表/子查询别名约定

推荐文章

在Java中解析HTML?

在Java中解析HTML?

推荐文章

如何从Razor页面用version number参数更新JavaScript文件

如何从Razor页面用version number参数更新JavaScript文件

推荐文章

无法使用addChild方法

无法使用addChild方法

推荐文章

应用程序的两种启动行为

应用程序的两种启动行为

推荐文章

数字常量前应为“;”

数字常量前应为“;”