Xcode 7 doesn't autocomplete if using bridging header - ios

So, the problem is that when I import anything in the Xcode 7 using Bridging Header Xcode doesn't autocomplete my code, no matter if I import given framework, header file in my current .swift, if it's just in bridging header Xcode doesn't autocomplete.
Though things are different dependently on framework, if I import Parse framework Xcode doesn't autocomplete at all, like no NSString, no other basic stuff.
When I tried to import FacebookSDK, Xcode autocompletes basic stuff like NSString, but it doesn't autocomplete FacebookSDK related stuff.
Also I tried running same project in Xcode 6 and there autocomplete works properly. Is it something wrong with my Xcode 7 or the frameworks?
I already tried deleting cache, derived data, reinstalling Xcode 7 but none helped.
Any tip?

The solution that worked for me is to make sure you put an individual path for each framework you include in your project as in the screenshot below.

Obj c.
Importing .h files into other .m files in the same project.
For time being i am type casting as work around.

The Facebook SDK frameworks weren't showing up in code completion for me. What finally worked was copying the framework files into the Project directory, though the Facebook official instructions recommend using references to the 'Documents' folder.
I tried the solutions from Morgan and Van Du in adding specific directories to the framework search paths, and doing recursion, but no dice for me. Had to fully copy into project directory (running Xcode 7).

after I have tried every solution at stackoverflow I remove all custom plugins – and this was it.
Xcode -> Windows -> Package Manager (in my case it was something about hightailing strings)

Related

Xcode 13: Headers of Imported Frameworks Inaccessible

I am having trouble with Xcode referencing header files from imported frameworks. The strange thing is that everything worked fine yesterday. But now, I cannot even import the same headers I see one line above that do not give me a compiler error.
You can see in the image below that the compiler is fine with "Ironsource/Ironsource.h" but when I'm trying to add it again it doesn't know what it is (but it did yesterday):
It is not a localized problem to one Xcode project, Xcode cannot see header files in any of my projects. Or more precisely, Xcode cannot see any NEW header files I would like to import but has no problem with the ones imported a day before. So, I am guessing it is something with Xcode, but I cannot figure out what went wrong.
Also, it doesn't matter if I try to reference headers in:
.framework
.xcframework
files.
The frameworks were added manually in the Project Navigator and can be seen properly in Target -> Build Phases -> Link Binary with Libraries.
I am using Xcode 13.3.1. and my project and used frameworks are both pure Objective C. I have both restarted Xcode and my Mac multiple times but they didn't help.
Does anyone have an idea what went wrong?
Framework headers are usually imported with angular brackets "<>". If you use quotes the compiler would search in the User header search paths in which case you would need to add the relevant path to User header search paths. Also make sure to make the header public if you use angled brackets.

Example-Swift.h not found

I'm developing an iOS framework that mixes Objective C and Swift code. Build fails at the #import "Example-Swift.h" line with 'Example-Swift.h' file not found.
The header file does get generated, I can find it at:
DerivedData/Example/Build/Products/Debug-iphonesimulator/Example.framework/Headers/Example-Swift.h
I tried all of the upvoted solutions on Stack Overflow, none worked. The only fix is manually adding the directory to User Header Search Paths in build settings.
I must be doing something wrong though if other people don't have to manually add the header path. Also, when users of this framework include it as a pod, they need to do update the build settings as well, which I really want to avoid.
So, is there a solution to this that's not an ugly hack? I'm using XCode 9.0.1. I wish Xcode / iOS had a normal build system... coming from Linux/Android, I like many things about the iOS ecosystem but the build system is just ridiculous.
I've seen this problem in a mixed Objective-C/Swift framework and my solution was to include the module name as the directory part of the include. In your case it would be
#import "Example/Example-Swift.h"
instead of
#import "Example-Swift.h"
This is actually documented in the Importing Swift into Objective-C subsection of Importing Code from Within the Same Framework Target at https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

AFNetworking files cannot be found

I have a project that is a couple years old, it uses Pods to utilize AFNetworking 1.3.3 (it was using RestKit, but I changed over to AFNetworking and still am having the same issues).
My import statements cause a compile failure
#import <AFNetworking/AFNetworking.h> // fail
#import <AFNetworking/AFHTTPClient.h> // fail
The error is simply:
Error:(23, 9) 'AFNetworking/AFNetworking.h' file not found
(or AFNetworking/AFHTTPClient.h if I try to import that one)
I can open the Pods folder in the project and clearly see the files there. I can even drill down into the classes, and my AppCode IDE auto-fills them in and/or auto imports them. But the project simply won't compile, as it does not recognize the imports above. See for reference, the files are there:
I've tried changing around versions of the framework with no luck. Any thoughts on something I may be overlooking? This project used to compile fine under older versions of Xcode, and nothing has changed with regards to the framework being used or the code using it.
Here is what my "Other C Flags" in build settings looks like with regards to what Pods setup:
Thank you in advance! Please let me know if there is more info I can provide.
It appears your IDE's list of include paths to search doesn't contain the directory of your AFNetworking headers.
Adding /Users/$USER/Desktop/blah/Pods to the list of "Other C Flags", much like in this answer for XCode, should solve your problem.

Xcode imports RestKit.h correctly in two files, but not into another file in the same bundle

I am having trouble making sense of what is going on here. I have a project using the Restkit Framework Library. The project was setup using Pods to install the framework and generate a workspace file.
I have three classes that are using RestKit.h, two of them (my app delegate, and my ViewController) import correctly, while a new file (a new ViewController) gives a red error on the import statement saying RestKit/RestKit.h file not found. Then when I try to use RestKit, I do not get code completion from xcode. However, the project builds and runs correctly after inserting RestKit Code.
Furthermore if I click "Jump To Definition" on the drop down menu when right-clicking a RestKit method in xcode, it takes me to RestKit source, implying that Xcode actually does know about the RestKit library.
Xcode version is 4.5.2
Any advice on where to look would be much appreciated.
Thanks

facebookSDK 3.1.1 file not found

I use XCode 4.5
I downloaded the SDK 3.1.1 from https://github.com/downloads/facebook/facebook-ios-sdk/FacebookSDK-3.1.1.pkg
and then I import the framework by dragging first and it does not work so I use the method of add other... in the build phases
I have this in my project:
and this in my build phases:
but when I import the FacebookSDK library like this
#import <FacebookSDK/FacebookSDK.h>
I have a file not found:
Did I miss something?
Ok I found the solution.
Actually the problem was from my Framework Search Paths in the search paths category.
I installed several time the facebook package and import the facebookSDK.framework several times and it adds me the link automatically in my Framework Search Paths.
I just removed all links and recreate a correct one manually and it worked.
if you have facebooksdk.frame work and its not working try this.
Remove frame work, delete it. clear your frame work search paths.
drage FacebookSDK.frame again and update your frame work path if you are working in team.

Resources