Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 warning with iOS Custom Framework: PRODUCT_MODULE_NAME may not be overridden for framework target 'MyFramework'

Tags:

ios

swift

xcode6

Created a blank framework in Xcode 6.1 for the Swift language and got this build warning.

warning: PRODUCT_MODULE_NAME may not be overridden for framework target 'MyFramework'
like image 346
David Robles Avatar asked Oct 29 '14 17:10

David Robles


People also ask

What is a framework in Xcode?

Xcode utilizes a ‘framework’ concept to package up a well-defined collection of code and resources as a single library file for inclusion in a main project. Each framework should represent a separated feature that can individually be tested, built, shared, and reused.

How do I add no such module in Xcode?

In Xcode, select the first party framework target, then in its Build Phase settings, add the ‘No such module’ to the ‘Links Binary with Libraries’ settings. Note, unlike for a main app target, there is no ‘Embedded Binaries’ settings for a framework target.

What frameworks are supported by a main iOS project?

A main IOS project can explicitly include, replace, or delete frameworks as required, however a framework you create can depend on other third party frameworks. The first party Authentication framework is dependent on third party frameworks, Auth0 and SimpleKeyChain.

How do I find the source of a framework in Xcode?

In Xcode, select the framework target, then add the following to the setting path Build Settings -> Search Paths -> Framework Search Paths The $ (BUILD_PRODUCTS_DIR) is a property that resolve to the build output folder, i.e. the derived data folder.


1 Answers

It turns out I had added the build setting "Product Module Name" at the project level and this was overriding the product module name to my new framework. I have 4 targets: a production, a staging, and 2 test targets, and I didn't want to deal with 4 different bridging headers and generated headers for Swift code.

The answer was to explicitly enter a "Product Module Name" build setting for my new framework target using the correct framework name. The alternative would have been to not use a project level build setting and add it as a target level build setting for every target.

like image 140
David Robles Avatar answered Nov 08 '22 16:11

David Robles