Necktwi
Necktwi

Reputation: 2617

iOS or macOS project: duplicate interface definition for ViewController

I am trying to build a common Xcode project for macOS and iOS. My project directory structure is

MyApp
  Common
    AAPLAppDelegate.h
    AAPLAppDelegate.mm
    AAPLRenderer.h
    AAPLRenderer.mm
  MyApp_iOS
    AAPLViewController.h
    AAPLViewController.mm
    main.m
  MyApp_macOS
    AAPLViewController.h
    AAPLViewController.mm
    main.m

build gives Duplicate interface definition for class 'AAPLViewController'.

I have added AAPLViewController.h in Build Phases -> Headers of corresponding macOS and iOS schemes.

I have also assigned corresponding macOS and iOS target membership to all files in MyApp_iOS and MyApp_macOS folders.

I tried comparing my project to an working macOS and iOS project but couldn't find a clue to avoid the error.

here is the git repo of it; macOS code isn't complete yet but iOS target should be built without above error.

Upvotes: 0

Views: 540

Answers (1)

toma
toma

Reputation: 1469

You need to correctly setup your headers search paths. First, set ALWAYS_SEARCH_USER_PATHS to YES. If that will not work - add only needed headers to USER_HEADER_SEARCH_PATHS setting.

enter image description here

Upvotes: 1

Related Questions