Code Monkey home page Code Monkey logo

ios-universal-framework's Introduction

FINALLY!

With Xcode 6, Apple has added iOS framework support to their build tools, so this repo can at last be retired!

Please use Apple's framework target for all new projects, as it is less hacky and is supported by Apple themselves.

iOS Universal Framework Mk 8

An XCode project template to build universal (arm6, arm7, and simulator) frameworks for iOS.

screenshot

By Karl Stenerud

Notes

2013-10-14:

Mk 8 is now out of beta!

I haven't been able to solve the problem of deeply nested projects within projects, but the new python scripts have been working in my other projects for over a year now and are quite stable for 90% of use cases.

Unfortunately, I don't have the time to solve the last 10% of use cases. As a compromise, I've created a branch "mk7" which contains the shell script version of the build system. If Mk8 doesn't work for your unique case, give Mk7 a try.

Development will continue in order to keep things working for the other 90% of use cases.

If you can help, please feel free to contact me or send pull requests. All scripting is done in Python now. All template development happens within the "devel" directory. build.py builds the templates and all template source files are in "src".

2012-06-16:

Updating your project to use the new scripts

You can now update existing projects to use the newest build scripts. Running the update_project.py script will replace your project's universal framework build script with the script in devel/src/BuildFW.py.

Before upgrading, please back up your project file!

Steps to Upgrade (Mk 7 or earlier):

If your project was built using Mk 7 or earlier, delete the first two universal framework build scripts. The first will be right after "Target Dependencies" and starts with the following (or something close):

set -e

set +u
if [[ $UFW_MASTER_SCRIPT_RUNNING ]]
then
    # Nothing for the slave script to do
    exit 0
fi
set -u

The second script is after "Copy Bundle Resources" and starts with the following (or something close). Note that this script may not exist in very early versions of the framework project:

HEADERS_ROOT=$SRCROOT/$PRODUCT_NAME
FRAMEWORK_HEADERS_DIR="$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Versions/$FRAMEWORK_VERSION/Headers"

## only header files expected at this point
PUBLIC_HEADERS=$(find $FRAMEWORK_HEADERS_DIR/. -not -type d 2> /dev/null | sed -e "s@.*/@@g")

The final script (the one you want to keep) will start with something similar to the first script you deleted.

Now proceed with the next steps below.

Steps to Upgrade (All versions)
  • Make sure the top of the "Run Script" phase for the universal framework script starts with the following comment: "# TAG: BUILD SCRIPT". If it doesn't, add it in!

  • Close your project

  • Run the project update script from shell: $ ./update_project.py ~/Projects/MyProj/MyProj.xcodeproj/project.pbxproj

  • Reopen your project

The project update script will create a backup (project.pbxproj.orig) of the old project file. To disable this behavior, use the "-n" switch.

Selecting Framework Type

The script now requires you to select which kind of framework (normal or embedded) you will be creating, using the config_framework_type configuration variable. Only the selected framework type will be created and shown to the user.

Note: Xcode requires the normal framework dir to exist, so when building an embedded framework, the script simply creates a symlink to the copy inside the embeddedframework. Be sure to tell your users not to to copy the regular "framework" symlink by mistake!

2012-06-12:

New Build Process

When you build normally (by selecting Build or CMD-B), the project will NO LONGER build a universal framework. It will build for the CURRENT ARCHITECTURE ONLY!

To build a universal framework, you must select Archive from the Product menu. Upon completing the archive build, it will automatically open the folder containing the fully built framework.

This cuts the compilation time down by 2/3, since it no longer has to do a full build process when building as a dependency.

Building From Command Line

Since "archive" is not a supported xcodebuild build action, you must specify the env variable "UFW_ACTION=archive" in your xcodebuild command to build it as a universal framework.

To avoid opening the destination folder when building from command line, set the env variable "UFW_OPEN_BUILD_DIR=False" in your xcodebuild command.

Only One Script

The initial beta version had 2 scripts: a clean script and a build script. Mk 7 has 3 scripts. With the new build process there is only need for one script.

Older stuff:

Xcode Bugs and their Workarounds

When Xcode creates the initial header and module file for a framework, the header file won't be included as a member of the framework target (This is a bug in Xcode; it does the same thing with Mac frameworks), so you need to do this manually. In Build Phases under Copy Headers, click the + and add the header, then drag it to the Public section.

The Run Script build phases will have the option Show environment variables in build log checked. A bug in Xcode causes it to ignore the template setting and leave it checked always. This can cause issues when diagnosing a build failure because Xcode will only show the first 200 log entries in a build phase, most of which are taken up by spitting out all of the environment variables! So be sure to turn it off manually.

So to sum up, when starting a new framework project, always do the following:

  • Manually add the header file it creates to your build target and mark it public.
  • Uncheck Show environment variables in build log in all Run Script build phases.

Why a Framework?

Distributing libraries in a developer-friendly manner is tricky. You need to include not only the library itself, but also any public include files, resources, scripts etc.

Apple's solution to this problem is frameworks, which are basically folders that follow a standard structure to include everything required to use a library. Unfortunately, in disallowing dynamically linked libraries in iOS, Apple also removed static iOS framework creation functionality in XCode.

Xcode is still technically capable of building frameworks for iOS, and with a little tweaking it can be re-enabled.

Static frameworks are perfectly acceptable for packaging code intended for the app store. Despite appearances, it's just a static library at the core.

Kinds of Frameworks

Dynamic Framework

A dynamic framework is designed to be installed in your operating system and shared by many programs. By default, Xcode only supports dynamic frameworks, and only for Mac since you can't use dynamic frameworks in iOS.

Static Framework

A static framework gets linked into your app like a static library would. However, Xcode doesn't include support for static frameworks. These templates add in that support. Frameworks are superior to libraries because they can include code as well as public headers in a single package.

Embedded Framework

Although frameworks are an improvement over libraries, Xcode ignores any resources contained within frameworks. So if you have xibs, images, sounds, or other files in your framework, Xcode won't see them. An embedded framework is a way to trick Xcode into seeing the included resources. As far as Xcode is concerned, they are simply folders, and so there are a few minor issues with embedded frameworks:

  • They don't show up in the Products group.

  • When you delete an embedded framework from a project, Xcode will not delete the outer folder (XX.embeddedframework), so if you try to re-add later, it will complain. You need to manually delete the XX.embeddedframework folder manually using Finder.

  • Things get a little tricky when you have a framework project as a dependency if your framework has resources that the parent project needs. You may need to manually add the resources to the parent or sibling project.

Choosing Which Template System to Use

In this distribution are two template systems, each with their strengths and weaknesses. You should choose whichever one best suits your needs and constraints (or just install both).

The biggest difference is that Xcode can't build real frameworks unless you install the static framework xcspec file inside the Xcode app, which might be a dealbreaker for some (this applies to the PROJECT, not the framework itself).

Short decision chart for the impatient

Note: Both types will build the exact same binary. The only difference is in how Xcode treats the project.

  • I don't want to modify Xcode: Fake framework

  • I'm just distributing the final framework binary (not the project): Either kind

  • I'm distributing my framework project to other developers who may not want to modify Xcode: Fake framework

  • I need to set up the framework project as a dependency of another project (in a workspace or as a child project): Real framework (or Fake framework, using the -framework trick - see below)

Fake Framework

The fake framework is based on the well known "relocatable object file" bundle hack, which tricks Xcode into building something that mostly resembles a framework, but is really a bundle.

The fake framework template takes this a step further, using some scripting to generate a real static framework (based on a static library rather than a relocatable object file). However, the framework's project still defines it to be of type 'wrapper.cfbundle', which makes it a second class citizen according to Xcode.

So while it produces a proper static framework that works just as well as a "real" static framework, things can get tricky when you have dependencies.

The problem with dependencies

If you're just setting up a standalone project, then you're not using dependencies, so there's no problem.

If, however, you use project dependencies (such as in workspaces), Xcode won't be happy. The fake framework won't show up in the list when you click the '+' button under "Link Binary With Libraries" in your main application project. You can manually drag it from "Products" under your fake framework project to add the dependency.

Note: In older versions of Xcode, you'd get warnings like the following:

warning: skipping file '/somewhere/MyFramework.framework'
(unexpected file type 'wrapper.cfbundle' in Frameworks & Libraries build phase)

This would be followed by linker errors for anything in your fake framework. As of Xcode 4.3.1, this doesn't seem to happen anymore.

If you do encounter this issue, you can work around it by adding a "-framework" switch with your framework's name in "Other Linker Flags" in the project that uses the framework:

-framework MyFramework

It won't get rid of the warning, which is annoying, but it does link properly.

Real Framework

The real framework is real in every sense of the word. It is a true static framework made by re-introducing specifications that Apple left out of Xcode.

In order to be able to build a real framework project, you must install an xcspec file inside the Xcode installation.

If you are releasing a project (rather than the built product) that builds a real framework, anyone who wishes to build that framework must also install the xcspec file (using the install script in this distribution) so that their Xcode can understand the target type.

Note: If all you're doing is distributing the fully built framework, and not the framework's project, then the end user doesn't need to install anything.

I've submitted a report to Apple in the hopes that they'll update the specification files in Xcode, but that could take awhile. OpenRadar link here

Upgrading from previous iOS-Universal-Framework versions

If you are upgrading from iOS-Universal-Framework Mk 6 or earlier and were using the Real Static Framework, and are still using Xcode 4.2.1 or earlier, please run uninstall_legacy.sh first to remove any patches that were previously applied to Xcode, then run install.sh and restart Xcode.

If you are using Xcode 4.3 or later, just run install.sh and restart Xcode.

Installing the Template System

To install, run the install.sh script in either the "Real Framework" or "Fake Framework" folder (or both).

Now restart Xcode and you'll see Static iOS Framework (or Fake Static iOS Framework) under Framework & Library when creating a new project.

To uninstall, run the uninstall.sh script and restart Xcode.

Creating an iOS Framework Project

  1. Start a new project.

  2. For the project type, choose Static iOS Framework (or Fake Static iOS Framework), which is under Framework & Library.

  3. Optionally choose to include unit tests.

  4. Add the auto-generated header file to the Public section of the Copy Headers build phase (workaround for Xcode bug).

  5. Turn off Show environment variables in build log for both Run Script build phases (workaround for Xcode bug).

  6. Add your classes, resources, etc with your framework as the target.

  7. Any header files that need to be available to other projects must be declared public. To do so, go to Build Phases in your framework target, expand Copy Headers, then drag any header files you want to make public from the Project or Private section to the Public section.

  8. Any static libraries or static frameworks that you'd like to have linked into your framework must be included in the Link Binary With Libraries build phase. Be careful doing this, however, as it can cause linker issues if the users of your framework also try to include the same library in their project for other purposes.

Building your iOS Framework

  1. Select your framework's scheme, iOS Device target.

  2. Under Product, select Archive.

  3. When the build finishes, it will open the folder containing the framework and embedded framework variants in Finder.

There will be two folders in the build location: (your framework).framework and (your framework).embeddedframework

If your framework has only code, and no resources (like images, scripts, xibs, core data momd files, etc), you can distribute (your framework).framework to your users and it will just work.

If you have included resources in your framework, you MUST distribute (your framework).embeddedframework.

Using an iOS Framework

iOS frameworks are basically the same as regular dynamic Mac OS X frameworks, except they are statically linked.

To add a framework to your project, simply drag it into your project. When including headers from your framework, remember to use angle bracket syntax rather than quotes.

For example, with framework "MyFramework":

#import <MyFramework/MyClass.h>

Template Development

If you're interested in tinkering with the templates themselves, I've changed the way they are generated. There are now template metatemplates, which are used to build the Xcode templates. Inside the devel folder there is a script build.py, which rebuilds the templates under Fake Framework and Real Framework. The source files are under src:

  • CleanFW.py: The project clean script (the first script in a framework project)
  • BuildFW.py: The project build script (the second script in a framework project)
  • FakeFrameworkTemplateInfo.plist: The fake framework metatemplate
  • RealFrameworkTemplateInfo.plist: The real framework metatemplate

Troubleshooting

Headers Not Found

If Xcode can't find the header files from your framework, you've likely forgotten to make them public. See step 7 in Creating an iOS Framework Project

No Such Product Type

If someone who has not installed iOS Universal Framework in their development environment attempts to build a universal framework project (for a real framework, not a fake framework), they'll get the following error:

target specifies product type 'com.apple.product-type.framework.static',
but there's no such product type for the 'iphonesimulator' platform

Xcode requires some modification in order to be able to build true iOS static frameworks (see the two diff files in the "Real Framework" folder of this repository for the gory details), so please install it on all development machines that will build your real static framework projects (this isn't needed for users of your framework, only for builders of the framework).

The selected run destination is not valid for this action

Sometimes Xcode gets confused and loads the wrong active settings. The first thing to try is restarting Xcode. If it still fails, Xcode generated a bad project (this can happen with any kind of project due to a bug in Xcode 4). If this happens, you'll need to start over and create a new project.

Linker Warnings

The first time you build your framework target, XCode may complain about missing folders during the linking phase:

ld: warning: directory not found for option
'-L/Users/myself/Library/Developer/Xcode/DerivedData/MyFramework-ccahfoccjqiognaqraesrxdyqcne/Build/Products/Debug-iphoneos'

If this happens, simply clean and rebuild the target and the warnings should go away.

Core Data momd not found

Xcode builds managed object model files differently in a framework project than it does in an application project. Instead of creating a .momd directory containing VersionInfo.plist and the .mom file, it simply creates the .mom file in the root directory.

This means that when initializing your NSManagedObjectModel from a model in an embedded framework, you must specify your model URL with an extension of "mom" rather than "momd":

NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyModel" withExtension:@"mom"];

Unknown class MyClass in Interface Builder file.

Since static frameworks are statically linked, the linker strips out any code it thinks is not being used. Unfortunately, the linker does not check xib files, and so if a class is referenced only in a xib, and not in objective-c code, the linker will drop that class from the final executable. This is a linker issue, not a framework issue (it also happens when you build a static library).

Apple's built-in framworks don't suffer this problem because they are dynamically loaded at runtime and the complete, unstripped dynamic library exists in the iOS device's firmware.

There are two ways around this:

  1. Have end users of your framework disable linker optimizations by adding "-ObjC" and "-all_load" to "Other Linker Flags" in their project.

  2. Put a code reference to the class inside another class in your framework that always gets used. For example, suppose you have "MyTextField", which is getting stripped by the linker. Suppose you also have "MyViewController", which uses MyTextField in its xib file and doesn't get stripped. You could do the following:

In MyTextField:

+ (void) forceLinkerLoad_ {}

In MyViewController:

+ (void) initialize
{
    [MyTextField forceLinkerLoad_];
}

They will still need to add "-ObjC" to their linker settings, but won't need to force all_load.

Option 2 is more work for you, but if done right it saves the end user from having to disable linker optimizations (causing object file bloat) just to use your framework.

unexpected file type 'wrapper.cfbundle' in Frameworks & Libraries build phase

This happens when you use a fake framework project as a dependency in a workspace, or as a child project (real framework projects don't have this issue). Even though the framework project produces a proper static framework, Xcode only looks at the project file, which says it's a bundle, and so it issues a warning during the dependency check and then skips it during the linker phase.

You can get it to link properly by manually adding a command to link your framework during the linker phase. Add a command to link your framework in "Other Linker Flags" in the project that depends on the framework:

-framework MyFramework

You'll still get the warning, but it won't fail in the linker phase anymore.

Libraries being linked or not being linked into the final framework

Unfortunately, due to the way Xcode works, the "Real Framework" and "Fake Framework" templates handle included static libraries/frameworks differently.

The "Real Framework" template follows correct static library procedure, NOT linking other static libraries/frameworks into the final product.

The "Fake Framework" template tricks Xcode into thinking that it's building a relocatable object file, and so the linking phase treats it as if it were building an executable, linking all static code sources into the final binary (although it doesn't check for missing object code). To get the "Real Framework" behavior, you should include only the header files from the library/framework in your framework project, not the static library or framework itself.

Unrecognized selector in (some class with a category method)

If your static library or static framework contains a module with ONLY category code (no full class implementations), the linker will get confused, and will leave the code out of the final binary. Since it's not present in the final product, you'll get "unrecognized selector" exceptions when any call is made to those category methods.

To get around this, put a dummy class into the module containing the category code. The linker, seeing a full Objective-C class, will link the module in, including the category code.

I've made a header file LoadableCategory.h to make this easier to do:

#import "SomeConcreteClass+MyAdditions.h"
#import "LoadableCategory.h"


MAKE_CATEGORIES_LOADABLE(SomeConcreteClass_MyAdditions);


@implementation SomeConcreteClass (MyAdditions)

...

@end

You will also need to add "-ObjC" to the "Other Linker Flags" build setting in any project that uses the framework.

Unit tests crash before executing any code

If you make a new static framework (or static library) target with unit tests in Xcode 4.3, it will crash when you try to run the unit tests:

Thread 1: EXC_BAD_ACCESS (code=2, address=0x0)
0 0x00000000
---
15 dyldbootstrap:start(...)

This is due to a bug in lldb. You can run the unit tests using GDB instead by editing your scheme, selecting "Test", and from the "Info" tab changing Debugger from LLDB to GDB.

History

Mk 1

The first incarnation. It used a bunch of script hackery to cobble together a fake framework. It exploited the "bundle" target, setting its type to a relocatable object file.

Mk 2

This version took advantage of the template system to do most of the work that the script used to do. Everything (including the script) was embedded in the template.

Mk 3

This version does away with the "relocatable object" hackery and builds a true static framework, with all the abilities of an OS X static framework. This solves a number of linker, unit testing, and workspace inclusion issues that plagued the previous hacky implementations.

It also includes the concept of the embeddedframework, which allows you to include resources with your framework in a way that Xcode understands.

Josh Weinberg also added some tweaks to make it build in the proper build directory with scheme-controlled configuration, and behave better as a subproject dependency.

It now requires some small modifications to Xcode's specification files in order to support true static frameworks, and thus comes with an install and uninstall script.

Mk 4

This version gives you the choice of installing the "real framework" template or the "fake framework" template. Both come with an install script, but only the "real framework" installer needs to modify Xcode.

This also fixes some issues that the fake framework had in Mk 2 (such as the curious behavior of embedding the full path to the compiled files within the files themselves, resulting in warnings when building with that framework).

Mk 5

This version does away with the extra target and script. Everything is self contained in the framework target, and the framework under the "Products" group is actually the universal framework (no more Debug-univesal or Release-universal folders).

You can build and clean like you would in any other project.

As well, the "Fake" framework template now builds a proper static library instead of a relocatable object file (although Xcode still doesn't believe that it's real).

Mk 6

This version makes the Xcode modifications for real static frameworks safer by simply adding an extra specification file instead of patching existing ones.

Mk 7

This version was supposed to be the one that no longer modified Xcode, but alas, Xcode behaves differently depending on WHERE the xcspec file gets installed. Take a guess at which location doesn't work...

@wtfxcode

So instead, this version basically handles the new install location of Xcode4.3.

Templates now build armv6 + armv7 by default instead of just armv7.

Note: If you previously installed real framework supprt under the broken Mk 7 (i.e. if you installed it on Feb 16th, or Feb 17th before 9:00 am PST, 2012), run uninstall_legacy.sh to uninstall the xcspec file from your home dir, then reinstall.

Mk 8

This version replaces the bash scripts with Python scripts. This gives a LOT more control over the build process.

To build the universal version of your framework, you must now use the Archive command rather than the Build command. Build only builds for the current architecture (to speed up compilation when your framework project is a dependency of another project).

Added a devel folder for template development.

License

Copyright (c) 2011 Karl Stenerud

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in the documentation of any redistributions of the template files themselves (but not in projects built using the templates).

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ios-universal-framework's People

Contributors

aet avatar dodikk avatar gamenerds avatar jweinberg avatar kemenaran avatar kstenerud avatar sirjordank avatar smirn0v avatar xiaowei4895 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-universal-framework's Issues

Broken spare symlinks

Here is the layout of a universal framework as produced with the latest version of the template, i.e. without the Universal_Framework target.

MyFramework.framework
├── Headers -> Versions/Current/Headers
├── Resources -> Versions/Current/Resources
├── MyFramework -> Versions/Current/MyFramework
└── Versions
    ├── A
    │   ├── A -> A
    │   ├── Headers
    │   │   ├── Headers -> Versions/Current/Headers
    │   │   └── MyFramework.h
    │   ├── Resources
    │   │   ├── Info.plist
    │   │   └── Resources -> Versions/Current/Resources
    │   └── MyFramework
    └── Current -> A

There are 3 broken symlinks:
A -> A
Headers -> Versions/Current/Headers (inside the Headers directory)
Resources -> Versions/Current/Resources (inside the Resources directory)

strange linking issue: the dependent framework won't be linked into app after modification

Hi, Karl

Firstly, thanks for your great job. but when I thought every thing was fine and perfect, I found a little problem.

I created two projects A and B. A is an app project which depends on B framework project.
as your solution, I add -framework B in A project, and it works fine, but not perfect. after I modified B project,
the A.app won't link the updated B.framework again. Unless I deleted the B.framework and generate it again.

so, it seems that the linker only use the framework's creation time to decide if re-linking, but not the framework's modified time.
it's really annoy. I haven't found any good solution for this except add delete operation in the pre-build action.
Do you have any good solution for this?

Thanks
Leon

Runs fine in simulator, but crashes on device

Using a Fake framework, compiles OK, but when the framework is placed into another project, that project runs perfectly in the simulator, but throws a EXC_BAD_INSTRUCTION when trying to run a method in the framework. Allocating a class in the framework seems to work ok, but running a method on it crashes.

Is there a setting or something I'm missing when creating the framework that will ensure it works on a device? The framework project has armv6 and armv7 architectures in the build settings (I'm also using the latest code, downloaded today).

Any ideas would be greatly appreciated.

No Such Product Type

Here's my set-up: Xcode 4.2.1 Build 4d502 running in OS X Lion (10.7.2).

I've installed successfully the script for Fake framework & Real framework.


Leonardos-MacBook-Pro:Fake Framework leonardoparrojr$ sh install.sh 
iOS Fake Static Framework Installer
===================================

This will install the fake iOS static framework templates on your computer.

The templates will be installed in /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library

continue [y/N]: y


[ Installing templates into /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library ]

mkdir -p /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library
rm -rf /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library/Fake Static iOS Framework Unit Testing Bundle.xctemplate
cp -R Fake Static iOS Framework Unit Testing Bundle.xctemplate /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library/Fake Static iOS Framework Unit Testing Bundle.xctemplate
rm -rf /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library/Fake Static iOS Framework.xctemplate
cp -R Fake Static iOS Framework.xctemplate /Users/leonardoparrojr/Library/Developer/Xcode/Templates/Framework & Library/Fake Static iOS Framework.xctemplate


[ Installation complete. Please restart Xcode. ]

I've restart Xcode and open my project again.. Clean & rebuild my project but then, I still encounter this compiler error:
"target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphonesimulator' platform"

Any idea? I've tried uninstall & re-install the iOS-Universal-Framework but still isn't working.

Can't set breakpoints in framework project

Hi,

I'm not entirely sure if this is an issue with iOS-Universal-Framework or Xcode itself, but I'm having issues with a framework project I created using iOS-Universal-Framework. It's a fake framework and I'm using the normal .framework file. I have the framework project and my app project in a workspace and I set breakpoints in the framework project's code but GDB never breaks on them. If I manually add a breakpoint with, for instance, SomeFile.m:123 then GDB tells me that it can't find the file called SomeFile.m so it looks like debug symbols are being stripped. I've checked and I definitely have the option for stripping debug symbols set to NO though.

Any thoughts on this issue or how to work around it?

Setup:

  • Xcode 4.2.1
  • iOS SDK 5.0

Matt

Bundled Framework

The title is more of a proposed solution to 2 issues I've found when using real frameworks:

  1. CoreData momd issue - as mentioned in the troubleshooting, when using the framework xcode retains the contents of the momd directory for core-data but flattens its contents to the root app directory, therefore core-data models cannot be accessed via momd extension but directly using the mom extension. Unfortunately, this imposes problems when using automatic migration by core data and can cause collision with other resources.
  2. Distribution issue - using the current creation method for a universal embedded framework, xcode isn't updated when the framework has new resources. E.g., initial version of the framework had a single resource image.png. I would send the myframework.embeddedframework to my clients and they would add it to xcode. If the second version of the framework had another resouce, image2.png, upon receiving the new version, the client would replace on the HD, the old version with the new one, but xcode would not detect the new resouce. The client would have to remove the old version and add the new version in order for xcode to detect changes.

I would like to propose a solution to the above issues: provide a similar solution as provided in myframework.embeddedframework, but instead of having a myframework.embeddedframework/Resources dir with links to resources in myframework.embeddedframework/myframework.framework/... . Have a real resources in a dir that ends with .bundle.

To see this in action just add the following before the last section in the xcode script:

$ Build embedded framework with bundle structure

echo "Build Embedded Framework with Bundle"

echo rm -Rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework"
rm -Rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework"
echo mkdir "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework"
mkdir "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework"
echo cp -a "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/"
cp -a "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/"
echo mkdir "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.bundle"
mkdir "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.bundle"
echo mv "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.bundledframework/Versions/A/Resources/"* "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.bundle"
mv "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.framework/Versions/A/Resources/"* "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.bundledframework/${PRODUCT_NAME}.bundle"

$ Replace other platform's framework with a copy of this one (so that both have the same universal binary)


In order to access the bundle in the iOS app you can use the following obj-c code:
NSString* bundlePath=[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"myframework.bundle"];
NSBundle* bundle=[[NSBundle alloc] initWithPath:bundlePath];

The above bundle will also be visible when calling: [NSBundle allBundles]

I hope this helps and if appropriate I would be happy to see this get into a release of iOS-Universal-Framework.

Punc.

cpio can't open input file

I followed the instructions and added some of my own files but failed to build the framework.

What am I missing here?

** BUILD SUCCEEDED **

lipo: can't open input file: ./build/Release-iphoneos/MyLIb.framework/MyLIb (No such file or directory)
Error: lipo failed
Command /bin/sh failed with exit code 1

embeddedframework in my project - can´t find headers

Hi there,

thanks for that little nice helper. It´s great.

But unfortunately i have a little problem with embeddedframework.
I can not find the header files which are included into the framework.
All header files are in the public section of the build phase.

I tried to manually set User Header Search Paths and Header Search Paths, but XCode can´t find my header files.

Do you have an idea what i am doing wrong?

Fake framework shows missing Headers on first pass only

When building my project with the mk7 fake framework I get a missing Headers warning:

Ls: /Users/x/Library/Developer/Xcode/DerivedData/driver-edwoigoqbhgsncfsrbkxnitmxmee/Build/Products/Debug-iphonesimulator/driver.framework/Headers: No such file or directory

Building it a second time that error goes away and the created framework bundle is fully functional.

Half of my .h files are in the Public group, other half in Private.

Xcode 4.3

It doesn't seem to work anymore with Xcode 4.3.

I now see these 2 errors:

ls: /Users/nef/Library/Developer/Xcode/DerivedData/libtest-bgengsjdhqtnyucvltgihjndqtcw/Build/Products/Debug-iphoneos/libtest.framework/Headers: No such file or directory

Preceding build task claims to succeed in spite of generating error messages. Please file a bug report.

storyboard embedded in the framework

Hi,

I'm trying to embed a storyboard in the framework but i would like to embed the source one (not the compiled one). The storyboard file is in the C.B.R. phase, but it is not in the "Compile sources" phase. When i compile i finally get a .storyboardc (compiled storyboard) instead of the source one, how should i proceed ?.

Btw: thx for your job :)

Additions classes (NSObject+addition.h) aren't compile?

I'm creating a small framework with additions to UIImage class in it's own file. It compiles fine on my application target, but when I use the static framework, I get bad access saying unrecognized selector sent to instance UIImage.

I made the header public, included it and still nothing.

I am not sure what kind of logs I should present you so if you need anything from me, please ask me and I'll provide you the information you need right away.

Thanks!

image path for embeddedframework

Thanks for this nice work. But I have a problem of image path in embeddedframework.

UIImage *img = [UIImage imageNamed:@"test.png"];

then create embedded framework. but the image is nil.

I also copy test.png to bundle resource.

How to resolve this? Thanks a lot.

Support for Cocoa Static Frameworks?

Setting up Xcode to use embedded private dynamic frameworks is a pain. I would much rather use a static framework in certain cases with Cocoa. It may also improve launch times because embedded private frameworks do not utilize the dynamic linker cache. Is it possible to add support for cocoa static frameworks too?

Thanks for this project. Apple should have added official support for this long ago.

Xcode crash when using xib or storyboard in embedded framework

If I build an embedded framework with user interface layouts, trying to process those files in a client application project causes problems for ibtool and Xcode.

ibtool is trying to run on the symbolic links in the top-level Resources framework, and bails with an error like this:

/* com.apple.ibtool.errors /
(path)/X.storyboard: error: Exception while loading document at path (path)/X.storyboard: -[NSFileWrapper regularFileContents] *
* this method is only for regular file type NSFileWrappers

This in turn causes Xcode to freak out and throw many exceptions and usually disables the Utilities inspector pane.

The same exception can be triggered by adding the Resources folder to the project and selecting what looks like a normal xib/nib/storyboard, but is in fact a symlink.

Perhaps, technically, this bug is actually in Xcode/ibtool, not handling symbolic links sanely. But perhaps there exists a workaround.

Note: I am using Xcode 4.2; perhaps this has been fixed in 4.3. (But my colleagues are having lots of problems with 4.3 and I am reluctant to upgrade.)

Fake Framework also causes invalid product type build abort

I tried the Fake Framework on iOS 4.2 and 4.0.2 and I keep getting this error message during build:

target specifies product type 'com.apple.product-type.framework.static', but there's no such product type for the 'iphoneos' platform

I have 3 installations of Xcode in various /developer_* folders, could this be a problem?

Headers in subfolders error

Hi, I'm wondering if you ever happened to be in a situation where your original .h files are organized in different subfolders within the project source code. What happens is that in the final .embeddedframework they all get flattened out and then if I include the framework in an app project, the references within the different headers are broken since they can no longer be referred with "subfolder/headername.h".

Do you have any suggestion about how to fix this without having to flatten out the whole library project?

Thanks!

EDIT

I've currently included the folder with all the classes and subfolders into the "include header search path" with recursive turned on. That way I'm referencing the name of the .h file without the relative path and it solved my problem. I'm not sure it's the best solution but it works.

[obsolete feature] Do we need symlinks for iOS ?

Since we have only static frameworks for iOS, we do not need framework versioning.
Hence, Versions directory is obsolete. Removing it should simplify scripts and make them more maintainable.

We should end up with a plain directory :

My.Framework
|
|---> My
|---> Headers
|---> Resources

This works. I've checked it by creating a framework out of some proprietary SDK manually. ( actually, I've arranged SDK files into a framework structure using 'Finder' ).

Using Resources - XIB

You mentioned that you can add resources. I added a couple XIB files, built it, and added the framework to my project. If I expand the triangle next to my framework I can see my header files are listed but not the NIB files. When I look at the framework in Finder I can see the NIB files. I do an initWithNibName:@"MyFramework.framework/MyResource". This has a runtime error of: Could not load NIB in bundle.
Can you get XIB resources to work? Or am I doing something wrong? Thanks!

Referring to custom classes from .xib in embedded framework issue

Thank you very much for creating these templates. They are a joy to use.

I have created a real framework and since I have resources, I am using the .embededframework version.

I am using the "custom class" assignment (via "identity inspector") in interface builder, referencing classes in the framework for some of my views in my .xibs (which are also located in the embededframework).

Unfortunately when I use the .embededframework in another project it crashes when it loads the .xibs because of "Unknown class MyView in Interface Builder file."

Do you know if what I'm doing is possible?

Also, can I rename the .embdedframework to .framework or does it need to stay named .embededframework?

Thanks,

Michelle

Set umask before root operations

The install scripts don't set a liberal umask for root operations. The result is that when the user has a safer umask such as 0027, the sudo cp causes the copied files to become unreadable by the current user. Alternatively, use rsync -a or install instead of cp.

error message:"The application bundle does not contains valid identifier"

Hi!

I started to use your solution today, very useful. I made everything, you wrote, I created a "fake" framework, build in releae configuration. Then I drag&drop the xy.embeddedframework folder to my project, and everything work (I can use xib files, etc..). But sometimes I got such error message, when I try to run the app on device. Most recent in cases, when I modify something in the framework, then I delete the references from the "main" project, and I add again.
In such situations, I couldn't do anything, I have to create a new project. This is very annoying. What i'm missing?

ld: duplicate symbol _OBJC_CLASS

Hello,

I'm getting a duplicate symbol linker error. I have an app which includes a sub project which is my fake framework (MyFakeLibrary). The linker error happens fairly consistently where I would clean my project and rebuild it.

When examining into my framework, I see that my object file is included multiple times for the same architecture (ie armv6)

I also noticed that when I do a clean, it's not removing the MyFakeLibrary.embeddedframework directory. The MyFakeLibrary.framework is deleted though.

$ nm MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary |grep SHKSafari.o
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv6):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv6):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv6):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv7):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv7):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture armv7):
nm: no name list
/Phunware/unfuddle/Common/Branches/MyFakeLibrary/Source/MyFakeLibrary/0.1/build/Debug-iphoneos/MyFakeLibrary.framework/Versions/A/MyFakeLibrary(SHKSafari.o) (for architecture i386):

No universal framework

Hi, I'm using XCode 4.2 (Build 4D199) under Mac OS X 10.7.2 (Lion).
I used to use iOS-Universal-Framework with XCode 4.0 under Mac OS X 10.6 (Snow Leopard) and then everything worked perfect. But since I upgraded, it doesn't work anymore.

I use the "Real Static Framework" template. What happens is I can create a project and build it without any problems. No errors are reported during build. BUT :

  • The scheme Universal_Framework does not exists. I have only one scheme which is named after my project.
  • In the finder, there are only two directories : Debug-iphoneos and Debug-iphonesimulator. There are no Debug-universal.

I can however build successfully the previous projects I have that I created before the upgrade.

So, What should I do to make this work under XC4.2/Lion ?

Thanks ;)

Building may require unnecessary "Clean all"

First, thanks for this great work!

My issue here is that I get various build failures if I make a change to my "real" framework when building an app with an explicit project/target dependency. I am able to workaround these failures by cleaning both platform types (iOS and simulator), then building again. There are different kinds of failures, but I think they might result from the script not building both platforms correctly.

One failure case goes like so:

  • clean everything
  • build app for simulator
  • touch a file in the framework
  • build app for simulator
  • build app for iOS -- Codesign failure: "object file format invalid or unsuitable"

Sometimes I get a complaint that there are no source files to build. Other times I get a complaint that some symbols are defined twice. Cleaning all and re-building fixes the problem in all cases.

+load in Real Framework

+load is not called after updating to Xcode 4.3.

I use the Objective C +load method in categories. The +load methods were being called nicely when using Xcode 4.2.

Thanks for putting this project together its been very helpful!

I was quite pleasantly surprised a few months ago to learn that while the +load methods don't get call when built into a static library (.a file) or a Fake Framework they were called when built into a Real Framework.

I've put together a simple project to demonstrate the issue. The +load code included in the Framework looks like this:

import "UIView+BMA.h"

import "LoadableCategory.h"

MAKE_CATEGORIES_LOADABLE(SomeConcreteClass_MyAdditions);

@implementation UIView (BMA)

  • (void)load {
    NSLog(@"+load -- UIView_BMA");
    }

@EnD

Linker errors when using external frameworks

I'm trying to wrap up a few of my own classes, which include some other tools like YAJL or ASIHttpRequest, into a framework that I can share across projects. However, when I try to consume my own framework I get an enormous number of linker errors because it's failing to identify those external framework sources. I can resolve my problem by manually adding all of the necessary frameworks into the project that is consuming my own project ... but this is pretty ugly. Is there something I'm doing wrong when compiling my own iOS-Universal-Framework?

Advice much appreciated..

Run install.sh

Can you please tell me the command for Terminal to run install.sh script. I've tried but I can't get it to work.

Categories + LoadableCategory.h

Thanks for the awesome work as it works really well for creating custom static frameworks!

I have noticed an issue that seems to be random, though. I have custom categories in my framework, so I had to use your LoadableCategory.h method so that they are properly linked into the final library. For the most part this works well without any issues. At times, especially when creating an archived build for adhoc distribution of my app using the custom framework, I get a compiler error similar to:

ld: duplicate symbol OBJC_CLASS$_FORCELOAD_SomeConcreteClass_MyAdditions in...

In the class category implementations I am using your MAKE_CATEGORIES_LOADABLE(SomeConcreteClass_MyAdditions); method, making sure it's always unique. I don't always get the duplicate symbol error on the same category, which makes it appear to be more random and something odd is happening. I have verified the files don't exist more than once which I know also causes the duplicate symbol error.

Any ideas?

Headers of .embeddedframework not found

I'm trying to include my .embeddedframework package into a project (I need to use the .embeddedframework because I have a XIB in my framework-project) by dragging the .framework-folder into the projects "Frameworks" group. In the import dialog I select the copy-option.
I cant use #import <MyFramework/MyHeader.h> in my project. It tells me the headers can not be found even if they are set as public in the Framework-Project Build-Phases settings. They are definitely in the .embeddedframework folder and they are included in the project.

Doesn't compile for armv6 in Xcode 4.2 (new problem)

I'm having the same issue. I can compile the framework fine when it's not a dependency of my main project. When I add it to my main project I get this:

=== BUILD NATIVE TARGET SQLiteMath OF PROJECT SQLiteMath WITH CONFIGURATION Debug ===
Check dependencies
[BEROR]No architectures to compile for (ARCHS=armv6 armv7, VALID_ARCHS=i386).
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)

I tried the suggestion from the other ticket but that didn't help.

It looks like the framework is built correctly. All the parts are there and the binary has both armv6 and armv7. It also compiles without error for the simulator. Just gets that error when compiling for device.

No longer seems to support dependency building

I have a workspace set up with two projects: the first is an iOS static framework ("Real"), the second is the project that uses this framework. Before todays changes, and with 4.2.1, changing something in the framework source and building the project worked as expected: the framework would be rebuilt. I tried owainhunt's pull earlier today on my other computer and that worked fine (still had this behavior). However, with the latest alternative changes (Mk.7), this no longer seems to work: that is, changing the framework and compiling the actual project doesn't seem to cause a compile of the framework to be initiated.

Executable Bits

Something else I noticed this morning is that executable bit is not set on the install.sh and uninstall.sh scripts when they are checked out. May want to chmod +x them

Sharing with other developers - linker warning

Hi,

i can successfully build my framework and work with it on my own Mac.
But there are problems when i share this framework with other developers.

There´s following linker warning:

ld: warning: directory not found for option '-F/Users/michael 1/Documents/Projekte/iPhone/SVN/test/test/fwtest/../../../../../Library/Developer/Xcode/DerivedData/MyFramework-fognfixcojlotibypyqsmfowrxgk/Build/Products/Debug-iphoneos/MyFramework.embeddedframework'

Why does XCode search something in the DerivedDate folder?
That does not make sense to me.

Hope you can help me with that

Unit Test target complaining about duplicate symbols after cleaning Framework Target

Hello.

I have an issue in my current project. I have two targets, the main framework target that builds my framework using the fake static template provided here and one unit test target that uses the built framework straight from the build/Debug-iphonesimulator folder. This works perfectly except when i clean the main target. This produces the following error:

ld: duplicate symbol _OBJC_CLASS_$_MyClass in (path-to-project)/trunk/build/Debug-iphonesimulator/MyFramework.framework/MyFramework(MyFramework) and (path-to-project)/trunk/build/Debug-iphonesimulator/MyFramework.framework/MyFramework(MyFramework) for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've tried to change architecture settings etc but i can't it to work when performing a normal clean. When this error occurs the only option left is to delete the build-folder and rebuild the framework.

Build script "cleans" too much

The following piece of the first build script is creating some problems for me

# Clean other platform if needed

if [[ ! -f "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" ]] && [[ "${ONLY_ACTIVE_PLATFORM}" != "YES" ]]
then
    echo "Platform \"$UFW_SDK_PLATFORM\" was cleaned recently. Cleaning \"$UFW_OTHER_PLATFORM\" as well"
    echo xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" clean
    xcodebuild -project "${PROJECT_FILE_PATH}" -target "${TARGET_NAME}" -configuration "${CONFIGURATION}" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR="${BUILD_DIR}" CONFIGURATION_TEMP_DIR="${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}" clean
fi

I want to build a Static Library that contains subprojects from Three20 (that i set up according to their setup). The subprojects deploy header files into the build products, that are removed by this script and then the build fails. I tried to come up with a solution, but since my time constraints are getting tighter, i just commented it out and it seems to be working.

Using framework classes in NIB files

When using a class from a Real Framework in a NIB, I get the following error when running the application:

Unknown class MyFrameworkClass in Interface Builder file.

MyFrameworkClass is included in the NIB file as an Object with Custom Class set to MyFrameworkClass. The actual case is that I have implemented a UITextFieldDelegate that is attached to a UITextField. I.e. I do not need any references to it in my source code. The problem persists even if I connect it to an IBOutlet in my View Controller.

If I use the class from my source code, either by allocating an instance or by implementing _keepAtLinkTime as described in http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime everything works fine. This is however not a user friendly interface to the users of the framework.

Are there any better ways to ensure that all framework items used in a NIB is included in the binary? A solution that always includes the entire framework in the binary is not desirable either.

Cannot select "Universal_Framework scheme"

On Xcode 4.2 I created a project from the template and went though the steps for getting the files in.

But for building I see only iOS Device and two simulator schemes, not the Universal_Framework scheme that the read me says I should select.

Shell Script Invocation Error

When building a Fake framework (XCode 4.2), we get:

ls: /Users/[user]/Library/Developer/Xcode/DerivedData/[project]-guaoggrgxmcnjlaokdcyoyfgvlmb/Build/Products/Debug-iphoneos/[project].framework/Headers: No such file or directory

Even through the directory (symbolic) is there and has all the headers

And then "Build task claims to succeed in spite of generating error messages"

Is there an easy fox for this or can it be safely ignored.

xcode 4.2

Hi Karl, Im trying to build a static framework using xcode4.2. I have previously had success with xcode 4 but now I am geting the error

"target specifies product type 'com.apple.product-type.framework.static', but there's no such product type for the 'iphoneos' platform"

I have unistalled and reinstalled the templates several times but this still persists. Before I waste too much time I wanted to check if you have tried this with xcode4.2

Using a fake framework in another project generates warning messages

With the fake framework template, object code that it generated would have the full path to the object file embedded within the finished binary. This would cause Xcode to emit warnings if the framework was used in another project on another machine.

Thanks to Eric Reid, who spoke to an Apple engineer about this at WWDC, the issue has been traced down to a build setting in the framework target: "Deployment Postprocessing" must be set to "Yes".

The latest commit adds this fix to the template.

Use embeddedframework in project dependency

When I add MyFakeFramework Xcode project inside MyProject, the only product that is available is the bare framework, but I need the embeddedframework because of the included resources. How can I set that?

Doesn't compile for armv6 in Xcode 4.2

Xcode 4.2 changes the definition of ARCHS_STANDARD_32_BIT to be just armv7. I tried settings the ARCHS variable explicitly to "armv6 arvm7", but this causes the shell script to crash while building the other platforms.

I'd still like to support older devices, so a fix would be much appreciated.

Include Project Option to Avoid Ambiguity

Hi there -

I just leveraged your excellent framework build in a project that has two .xcodeproj files that are siblings in a directory. The Universal Framework script choked because it did not know which project to use (one is for the framework, one is for an example app). I made the following patch to the script at line 29:

xcodebuild -project "${PROJECT_FILE_PATH}" -target "${UFW_TARGET}" -configuration ${CONFIGURATION} -sdk iphoneos${UFW_SDK_VERSION} BUILD_DIR=${BUILD_DIR} CONFIGURATION_TEMP_DIR=${CONFIGURATION_TEMP_DIR} clean build
if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi
xcodebuild -project "${PROJECT_FILE_PATH}" -target "${UFW_TARGET}" -configuration ${CONFIGURATION} -sdk iphonesimulator${UFW_SDK_VERSION} BUILD_DIR=${BUILD_DIR} CONFIGURATION_TEMP_DIR=${CONFIGURATION_TEMP_DIR} clean build
if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.