iosxcodeframeworksbuild-errortargeting

Build-time errors when targeting device, fine in simulator


I have recently made two Frameworks (Extensions & SpotifyAPI), which are targeting iOS 10 just like my project. My phone is running iOS 12 beta (16A5345f). Xcode is running Version 10.0 beta 6 (10L232m).

Here is the project when I target the simulator or my device:

enter image description here

Ignore the warnings, they are expected. The errors are not expected.

For a reason I don't know, the Frameworks don't seem to be recognised when my iPhone is targeted. ALL these errors are functions, variables etc, which are apparently "unresolved identifiers" or "undeclared types" or "has no members" from my Frameworks.

Why does this only work for the simulator, and not my device? Is my Framework not supporting a certain type of architecture?

Here is my hiarachy:

enter image description here

I tried to run it in Xcode 9, but I got this:

enter image description here

So I deleted and reinstalled Xcode 10 but still with no luck.

How can I allow my project to run on my device?


If you have any questions, please ask!


Solution

  • Well this was frustrating... but I know people will come across this problem in the future, so here the answer is. All you need to do is build the Frameworks targeting your iOS device, and then it will work completely fine. Apple, couldn't you make it any clearer?

    However, this causes the opposite problem, that the device no longer works in the simulator. 🤔

    EDIT:

    I found this Medium post about how to make a universal framework, and got it to work 😀