简体   繁体   中英

How to use a tvos framework in a tvos app

Either this is a bug or I'm missing something.

If I create a TVOS framework and add it to a TVOS app, it loads fine on the simulator, but fails to load on a device.

Here's what I did (Xcode 7.3):

  1. Create a new workspace.
  2. Create a TVOS framework inside the workspace, top level.
  3. Create a TVOS app inside the same workspace, top level.
  4. In your TVOS app, general settings, add the framework to "Embedded Binaries".
  5. Run it in the simulator.

OK, so far, so good. Everything works. You can call methods in the framework.

  1. Plug in an Apple TV and run it on that.

Now it all falls apart. While loading, it barfs with the following:

dyld: Library not loaded: @rpath/myfw.framework/myfw Referenced from: /var/containers/Bundle/Application/E3183715-ADD6-492F-BC72-63CA853FF147/myapp.app/myapp Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/E3183715-ADD6-492F-BC72-63CA853FF147/myapp.app/Frameworks/myfw.framework/myfw: mach-o, but wrong architecture

You might have build your TVOS framework only for the simulator. Build your framework for "Generic Device" and then try to run your app on the device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM