I am using broadcast extension to capture my iPhone screen, In same project I am using some framework, which are working perfect in my project target, If same Framework I am importing in BroadCast Extension target like in side "SampleHandler" class(This is broadcast extension "RPBroadcastSampleHandler" Class), I am facing compiler issue as "Could not build Objective-C module 'your framework name'", As framework build in objective-c and my project is in swift. I am using "POD" to install all framework. I have also try with killing Xcode, Clean drive data, uninstall POD and install back several time, But still not getting any luck. I have also try creating Bridging-Header and import these library in side Bridging-Header and getting "Could not build module 'Your framework name'"
Kindly suggest which changes need to do in framework code to compile in different target in same project. As we are only writing that framework.
to make this work
Go to traget -> setting-> Require Only App-Extension-Safe API = NO
Related
I am creating custom dynamic framework in pure swift lang which is using a pre-compiled iOS Realm framework (downloaded from their website). I have tried various options to use this framework in an external project but it fails saying Realm was not found.
Here are some of the things I have tried already
Used Realm binary and headers from the framework, added them to the
project and import using a plain import Realm statement
Use the framework in the project ad directed by the instructions on
the above link. #import <Realm/Realm.h> in the umbrella header of
the framework
In both cases the framework compiled without any errors. But when I try to compile another project which uses my framework, I get different errors
Swift compiler error- Module 'Realm' not found (in the MyFramework-Swift.h file)
<Realm/Realm.h> file not found (inside the umbrella header)
My questions
is it possible to use a framework inside a dynamic framework?
if it is, do I need to give specific compile settings in order for a wrapper project to find Realm framework in MyFramework?
I'm trying to compile a basic Cocoa Touch framework to test this new feature in iOS 8 but I'm encountering some problems. First of all the framework doesn't import any other frameworks or libraries and the deployment target is set to iOS 8 (regular project when trying to create an Cocoa Touch framework. I added two methods:
- addValue:toValue
- subtractValue:fromValue
Compiling the framework goes without any problems as long as I'm not trying to code sign it. When I import the framework in my TestFramework project and I press build I getting this as build result:
I'm running into a peculiar error which doesn't seem to affect anyone on the web because nobody has complained about this error yet. The error is as following:
Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: replacing existing signature
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: invalid resource directory (directory or signature have been modified)
I mentioned that this "invalid resource directory" is an known issue for MAC developers but I can't seem to find the right solution. Who can point me in the right direction?
EDIT: I found out that it definitely has something to do with the code signing. Probably I need to code sign the framework too but that's not possible because I encounter the same error.
In my project I had two targets, 1) The main application which loads 2) a bundle of plugins. I have started to have objects which need to be available in both targets, so naively tried to compile them separately in each target (producing warnings about having different implementations: Class X is implemented in both Y and Z. One of the two will be used. Which one is undefined.)
To solve this I decided to create a framework, so I added a framework, but I don't know how to make it so that a) both the main app and bundle access the framework (via the compiled framework, and not just through the headers in the project), and so the framework is compiled when I run the project.
If you know how to do this, thanks!
Here are the steps I followed:
Create a new framework in the project , copy all the shared code over.
In the main header of the framework, include the headers of all the shared code.
Build the framework to test it builds (e.g. select the scheme of the framework and click play)
Go to the Build Phases of both the Application and the Plugin Bundle and add the framework to ‘target dependencies’ and ‘Link binary with libraries’
To include the frameworks stuff in code in the app and bundle, just use the main header, and use <> rather than “" e.g if your framework was called Foo use #import
When it comes to deploying, there might have to be some fiddling with where the framework gets installed, currently it gets put alongside the app itself, rather than inside, but I will probably fix that later :)
I was asked a question, what will happen when a framework is accidentally deleted from your device may be iphone or mac?
Whether your application crash or it will work without any error?
Please provide me answer with explainations.
You may get linking error. If framework folder is inside the application means its runtime linking.
OS X embeds an "install name" inside each dynamic library. This
install name is the path to where the library can be found when dyld
needs to load it. When you build an application that links against a
dynamic library, this install name is copied into the application
binary. When the application runs, the copied install name is then
used to locate the library or framework.
$ otool -D /Applications/Google\ Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python
/Applications/Google Drive.app/Contents/Frameworks/Python.framework/Versions/2.6/Python:
#executable_path/../Frameworks/Python.framework/Versions/2.6/Python
so if you will delete Frameworks folder you will get Dyld Error.
Dyld Error Message:
Library not loaded: #loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from: /Applications/Transmission.app/Contents/MacOS/Transmission
Reason: image not found
If a framework is deleted, only software linking to that framework would be affected.
If it is a system framework, expect your system to start failing.
If it is a 3rd party framework, it should be limited in scope of impact.
If it is in your app bundle, and your app is code-signed, the removal of the bundled framework should prevent your app from launching.
It depends on if the application needs access to the framework you have removed.
If you application requires the framework then it will not compile.
If you dont need it, it will just compile like normal.
This question will be easy for Xcode pros but for a MonoTouch developer it seems to be impossible to resolve. :-)
I'm using Xcode 4.5 and I want to target iOS 5.1 and above and iOS Simulator 5.1 and above.
I have a a library project here and it is coming with a prebuilt binary named "DemoLib" (no extension and it is 11MB in size). The library is a fat lib for Simulator and iOS 5.1+.
I can use that library without any problem.
However if I try to build the library myself, I end up with a "DemoLib.a" file (notice the extension and the size of 30MB). How can I get the same build result? What is a .a file compared to the file without extension?
I tried to build the project "for running", and "for archiving" in Xcode. Both results in the same 30MB .a file.
I was expecting some dropdown in Xcode where one could select "DEBUG" or "RELEASE" build and the latter one would create the smaller lib.
Of course I could never tell without seeing the framework's project file. Having said that, there is an excellent guide to creating and compiling iOS frameworks here: https://github.com/jverkoey/iOS-Framework
Using the above guide, you should be able to recreate your framework's project from scratch, add the files you have to it, and properly compile it.
Hope this helps! :)
Did it come with a Makefile? Create a new target, set the build settings of the target to what's in the Makefile, then set your project to depend on that new target.
A file with the .a is a static library, which means it depends on nothing external and all the code it needs is compiled inside it. I think no extension generally implies dynamic library, which means it'll depend on some dependencies being present on your system to link against. Maybe that's why the .a is so much bigger. I think Xcode will build static by default because iOS does not allow the use of dynamic libraries.
The dropdown for what to build is in your scheme. Command+shift+< to view your scheme. Within the scheme you can edit which environment each method of building will use.