Why am I getting an unavailable declaration using framework - ios

I'm making a swift .framework, but I'm running into what I believe is a build problem. So I've simplified everything to isolate my troubles. I've attached a screenshot of my newframework.framework project (top) and my example usage of the framework (bottom). The problem I'm having is that Whatever class is unavailable when I include newframework.framework. I can confirm that Whatever.swift is indeed included in target>>buildphases>>compile Sources
What could cause this not to work?
EDIT - Adding App Build phases screenshot

Your problem, as we figured out in comments, was that you were building your framework for "Generic iOS Device" and building your app for the simulator. Xcode can't make the app build without matching architectures, so you need to choose one over the other or produce a framework that includes every architecture.
(This was posted to help people who come here from the future find the answer quickly. Hello, future people!)

Related

Lexical or preprocessor issue in react native while building ios app <React/RCTUtils.h> not found

When I am trying to build my ios app in xcode, the build is failing due to lexical or preprocessor issue the error shows up like this
This was a problem specific to the react-native-device-info module.
For your specific case you may try v1.6.1 or higher (currently at 2.0 as of May 21, 2019) of the library and that should fix things for you.
For others interested more generally in the problem, this is a react-native library that uses native code, so it has an XCode project embedded within it for use in react-native after you run react-native link react-native-device-info. Unfortunately, the library was not including any directories in it's header search path, so it was of course unable to find the header files for the react-native objects it was using locally.
A library user proposed a change that fixed that problem for tvOS, and I extended the change to cover iOS as well, and now the library no longer generates errors like this for iOS or tvOS targets.
Perhaps someone with a similar issue may find the specific changes required for the fix useful in their projects

How to create framework with inner frameworks?

I absolutely can not understand how it works. I started with a simple one: created framework using "Cocoa Touch Framework" template and add some code to source files. Then using cocoapods I installed some pods to this framework-project. All looks good (maybe not so good actually) and build fine. After that there was an attempt to connect my framework to other xcode project. I did this as follows: just took my test.framework file from Product folder and transferred to another project. At first everything was not bad. The import was successful and I can use my framework-code in another project. But when I run it I have error: dyld: Library not loaded: Reason: image not found. I tried all of the answers to this problem, but nothing helped me.
After that, it was decided to try to connect my framework to other project. This time I got a completely different behavior: namely, I was able to connect the framework, but I could not access the code inside it. I'm completely confused, because I did not change anything. I just did the same with another project.
Please help me. What am I doing wrong?
A related questions:
Can I connect the framework just moving test.framework file into
another project?
For some reason, I should use the approach described above, is there a chance in the theory of success or all that I have done before is not correct?
I tried it a lot with the same result you get , until I posted the problem in Apple forums and they respond with Nested frameworks are not supported in IOS

Annoying XCode Source Kit bug with multiple targets

I'm struggling with this problem for nearly half a year now with multiple XCode versions and Macs.
I can't reproduce bug steps exactly but the things go off when project has multiple targets like for Mac and iOS.
First of all XCode declines to take #if os into account and always highlight syntax only in one type of sections. E.g. if I have os(iOS) and os(OSX) somewhere it will chose only one and highlight only them.
Same goes for autocompletion. Things just not working in that type of projects.
I really dont know what to do since developmenet process turns into struggling. I dont want to split my project into multiple one, I'm happy with multi-target setup.
Is there a way to fix that?
Almost a year late.
Anyway I faced the same situation where a multi target OSX/iOS application in Xcode did not take into account the #if TARGET_OS_IPHONE conditional and failed to autocomplete method names from framework only showing the iOS variant.
Found a solution, based on this blog entry : you have to clearly state the Framework search path on each target in Build settings
Edit: This line was present in the iOS target settings. I copy/pasted it to the MacOS target in Xcode where it was automatically adjusted to the right path.
Edit 2: Loosely related but if you run in trouble with interface builder picking wrong classe files see this answer I just posted in another old thread.

xcode build settings for imported libraries (xcode 5)

I'm having a small issue with xcode (I'm assuming it's mostly due to being unfamiliar with xcode itself) and was hoping someone could lend me a hand.
I'm working with a group of people and we're using the GPUimage framework.
The problem is this:
For every person referencing GPUimage we get additional entries in the build settings for the xcode project.
For example build products path would be:
/Users/username/project/application_name/GPUImage-master/GPUimage.framework
I would rather it be:
/application_name/GPUImage-master/GPUimage.framework
The reason I want to fix this is because we need to package up our application and library together so that whoever wants to use it only needs to open the xcode project file to see what we've done (to mark it, school project).
Can anyone suggest what I should do or look for here?
Try adding the following to the beginning of the user path:
$(SRCROOT)/application_name/GPUImage-master/GPUimage.framework
That should instruct XCode to use the user path of whoever is using the library
Hope this helps!

Flex ANE, iOS and ARC

Good day
I have created a static library with Xcode. Then I compiled my ANE using adobe's ADT tool. Thereafter I've included the ANE in my FlashBuilder project. However, when attempting to package my project, I get the following error:
"Error occurred while packaging the application:
Undefined Symbols: "_obj_storeStrong", referenced from ...
.
"_obj_release", referenced from ...
.
"
My guess is that ARC is probably not supported for ANE's. I'm guessing that this is probably due to the fact that FlashBuilder is recompiling the entire AIR + the native libs into one iOS application, probably using their own compiler or something (which is why Air apps for iOS can be compiled on windows platforms as well), and this compiler is probably not 4.3 ready yet?
I have attempted adding the flag -fobjc-arc to my ios-platformoptions.xml as well (where this file is the parameter to the -platformoptions flag of adt), but still no joy. It results once again in an error when packaging. Perhaps any other flag I can try to use here?
Any corrections, suggestions, alternative ideas or comments will be most welcome. I am very new to Xcode, Objective C and ANE, so please excuse any incorrect statements or assumptions, and please correct me on these.
I would be glad if somebody can please confirm weather I am correct with my assumption that I cannot use ARC at this stage on ANE's.
Thanks
Christo
START EDIT:
Very late update, sorry.
You might be able to use ARC after all. There is a library called arc lite that I forgot to mention and it works. I created an ANE for MapKit on iOS targeting the 5.0.x SDK. When I tried to move to a device that only had 4.3.x ( could have been 4.3.3 or 4.3.5 ) the app crashed or would not compile. I found information on the arc lite library that is included in the newer sdks, followed the instructions on how to include this library and pow! A working ANE on a 4.3.x device without rewriting my code!
Hope all of this helps and half of my original comment :)
Markus
END EDIT
I don't think ARC is supported just yet. There isn't much to go on in terms of settings or examples of what the settings should be in Xcode. Take a look at any of the Xcode ANE projects you can get your hands on. You will see that most or all of the projects have:
Object-C Automatice Reference counting = NO
Objective-C++ Automatic Reference counting = NO
Take a look at the following:
Vibration ANE - On Adobe Devnet site
Liquid Photo - http://www.liquid-photo.com/2011/10/30/common-native-extension-issues/
Liquid Photo - http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/
There are a lot of examples in Github but you have to find them via Google. Pull down the Xcode ANE projects and compare the settings.
Hope this helps!!!
Markus

Resources