How to set up a common infrastructure for iOS and OS X

I want to create a common infrastructure for iOS8 and OS X, as described in this Apple seminar from WWDC14

I followed all my steps, but in my project (which is in Swift, not Obj-C) the framework was not found, even after adding

$ (CONFIGURATION_BUILD_DIR)

in the application header search path. I will explain in detail how I came to this question:

  • I am creating a new project using a simple Single View application .
  • In the application, I create a new goal, which is the Cocoa Application .
  • In the sample application, I am creating a new Cocoa Touch Framework .
  • In the new framework, I am adding a new target, which is the Cocoa Framework . This is the initial setup of the project.

Xcode project after step 4

  1. I am adding a shared group in which I will save code that should be shared.
  2. I select Mac Framework Build Settings and replace the text Public Folder Folder Folder

ExampleFramework

  1. Repeat step 6 for iOS Framework

  2. As in the video, I get a build error after adding this parameter to the AppDelegate of my Mac App:

import ExampleFramework

  1. I select Build Settings for my Mac application and add to the header search paths

$(CONFIGURATION_BUILD_DIR)

  1. I am trying to create a Mac application but still getting an error

no such module ExampleFramework

  1. Finally, I'm trying to fix the error by adding the ExampleFramework Mac target in Dependencies and Link Binary With Libraries Mac , but still get the same error.

Even after creating the Framework, Xcode still does not find the "ExampleFramework" module in my AppDelegate. If I replaced

import ExampleFramework

with the name of the target structure, which is ExampleAppMacFramework, I get an error:

Failed to create Objective-C module "ExampleAppMacFramework"

Do you have an idea what I'm doing wrong, and maybe how I can do it? I tried this workaround , but that didn't help me either.

+4
source share

All Articles