2

I incorporated ReplayKit in my app with Xcode 7. When I tried to overwrite an existing version of my app on an iOS 8 mobile phone (developed with Xcode 6), it hanged with the following error.

dyld: Library not loaded: /System/Library/Frameworks/ReplayKit.framework/ReplayKit Referenced from: /private/var/mobile/Containers/Bundle/Application/6F141C8C-AFB3-41B7-8C27-68CD00E7786F/xxx.app/xxx Reason: image not found

May I know if it is because I can only import ReplayKit for iOS 9? If so, what should I do? Currently, I just

import ReplayKit

Thank you in advance.

LFS
  • 145
  • 1
  • 9

2 Answers2

3

You need to open Build Phases for your target change the Link Binary with Libraries status to Optional for ReplayKit. This allows the app to run even when the ReplayKit framework is unavailable. enter image description here

ylgwhyh
  • 1,588
  • 18
  • 21
1

ReplayKit seems to be available only since iOS 9. If you attempt to use it on iOS 8, you will get a runtime error.

You should check for feature availability before using a framework that may not be available for some of your deployment targets. Here is one tutorial on how to do that.

Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
  • Thanks, I added feature availability checking for methods such as: @available(iOS 9.0, *) extension GameViewController: RPPreviewViewControllerDelegate {...}. However, I still get the same error. I suspect that it has something to do with the import statement throwing an error, but I cannot just add @available to an import statement... How do I resolve this? – LFS Sep 24 '15 at 05:33
  • 3
    Hi, I resolved the issue. I need to make sure that the ReplayKit library is optional under the Build Settings. :) Thanks for your suggestions, Nicolas, as it helps me to eliminate other possible reasons. – LFS Sep 24 '15 at 05:48