问题
Does anyone face this issue when trying to run their application on an actual iPhone (iOS version 8.4) using Xcode 7 Beta 4?
dyld: Library not loaded: /System/Library/Frameworks/GameCenter.framework/GameCenter Referenced from: /private/var/mobile/Containers/Bundle/Application/CC713E5A-7839-43F1-9AEB-932AE2A3DF8A/.... Reason: image not found
For your information, it has been working with no errors before I switch to Xcode 7...
回答1:
Looks like the issue is gone in XCode Beta 5. Somebody to confirm this?
回答2:
In Project Settings->Build Settings weak link both the new iOS 9 GameCenter lib and the old GameKit libs and try again. You can weak link them by specifying the 'Status' as 'Optional'.
You need the old one still incase you're running on an older iOS than 9 which will need the GameKit stub library linked in still as it won't know about the new GameCenter one for iOS 9.
It may also be necessary to change
#import <GameKit/GameKit.h>
to
#import <GameCenter/GameCenter.h>
If I had to guess the change might simply be down to using a less generic library name as Apple continue to add more game orientated libs (Spritekit, Scenekit, Replaykit etc), renaming the main GameCenter lib from GameKit to GameCenter makes sense.
回答3:
For me, it worked well on iOS 8.4 and iOS 9 with these modifications to the above suggestions:
- Don't change your code, just stick with #import < GameKit/GameKit.h >
- When building with XCode 7, add GameCenter.framework (weak link / optional) and don't change this option for the GameKit.framework (required)
That's it.
If XCode7 gives you a linker error about GameKit.Framework, go back to XCode 6.4 and rebuild the project (disable the target membership of GameCenter.framework in the file inspector before). Then go back to XCode 7 - the linker error is gone.
来源:https://stackoverflow.com/questions/31779111/gamecenter-framework-image-not-found-error-for-xcode-7-0-beta-4