GameKit/GameCenter - I386

Fel*_*ipe 3 iphone xcode objective-c game-center

我在iOS GameCenter上遇到了一些困难,我正在关注youtube上的一些教程, 但是一旦我完成代码,我就会收到这个错误:

Ld /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator/Game-Center-Test.app/Game-Center-Test normal i386
    cd /Users/fgringo/Documents/DEVELOPER/Game-Center-Test
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator -F/Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator -F/Users/fgringo/Documents/DEVELOPER/Game-Center-Test -filelist /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Intermediates/Game-Center-Test.build/Debug-iphonesimulator/Game-Center-Test.build/Objects-normal/i386/Game-Center-Test.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework UIKit -framework Foundation -framework CoreGraphics -framework GameKit -framework MediaPlayer -o /Users/fgringo/Library/Developer/Xcode/DerivedData/Game-Center-Test-aggpqkxrazgvnseohuityqvchrnm/Build/Products/Debug-iphonesimulator/Game-Center-Test.app/Game-Center-Test

ld: warning: ignoring file /Users/fgringo/Documents/DEVELOPER/Game-Center-Test/GameKit.framework/GameKit, missing required architecture i386 in file
ld: warning: ignoring file /Users/fgringo/Documents/DEVELOPER/Game-Center-Test/MediaPlayer.framework/MediaPlayer, missing required architecture i386 in file
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_GKLocalPlayer", referenced from:
      objc-class-ref in GameCenterManager.o
  "_OBJC_CLASS_$_GKLeaderboard", referenced from:
      objc-class-ref in GameCenterManager.o
  "_OBJC_CLASS_$_GKScore", referenced from:
      objc-class-ref in GameCenterManager.o
  "_OBJC_CLASS_$_GKAchievement", referenced from:
      objc-class-ref in GameCenterManager.o
  "_OBJC_CLASS_$_GKPlayer", referenced from:
      objc-class-ref in GameCenterManager.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

Jon*_*an. 7

看起来您还没有将GameKit框架添加到您的项目中.

如果你使用Xcode 3.2.x:

  • 右键单击Frameworks文件树中的组/文件夹(在xcode窗口的左侧)
  • Add,然后选择Existing Frameworks...
  • 滚动GameKit.framework并双击它

如果你使用Xcode 4:

  • 在文件树中,单击项目(顶部的项目)
  • 选择目标
  • 转到Build Phases主面板上的选项卡
  • 展开 Link Binary with Libraries
  • +按钮
  • 滚动到GameKit.framework并双击它.