referring to an installed pod within Prefix.pch - ios

Finally taking on pods. Everything seems to work, for example, dropped in Parse, install pod'd, see it in a view controller.m file just fine.
BUT.. now i want to drop Parse into the pch as i use it so often. My pre-pods line was:
#import "Parse/Parse.h"
I tried this, and
#import <Parse/Parse.h>
and
#import <Parse.h>
.. and every variant i can think of, no luck. I can of course drop imports where required, but this is more convenient, despite the suggestions not to use this route.
What i find most confusing is that the UI pre-fills in the path for me for second option, so it finds it, but on build, it fails with
'Parse/Parse.h' file not found.
Thanks for suggesting a working syntax.

This may not be the perfect answer, as there are so my cocoapods fans using the repo that this is likely due to my newness to it, but i had to manually create an entry into User Header Search Paths which was "Pods" and set it recursive.
Then all was good.

Related

iOS - Unable to build, header missing (although present in folder)

I installed HTMLKit via pods.
Everything went well and I am able to see it loaded.
Unfortunately, when I try to build the project, it fails telling me that it couldn't find a specific header.
This is how I import the pod in my file:
#import "../../../Pods/HTMLKit/Sources/HTMLParser.m"
I am no expert in objective c so I am not sure if that's correct. One thing that is weird is that I always imported header files, but this time it seems that I need to import an .m file?
If I try to import the header file of that, it simply says that the header is not found (although, as always it's there in the folder).
I am not sure how to fix it. I've seen some answers here on SO but they all use a different version of xcode so I am not sure what to do.
Try #import <>
And if it show you something automatically I think it will work.
Again, Not “”. Use <>.

Referring to an .h class of a subproject

the Dropbox iOS SDK has its own Framework bundle but in order to customize it easily I ve chosen to include its Xcode project as a subproject.
How should i refer to its .h classes?
I ve added the .xcodeproj from the "Add files" button and I ve added in the Header Search Path the following value:
$(PROJECT_DIR)
The subproject looks to be at the same level with the main project.
Shouldn't the importing itself link the dependencies?
(I m really frustrated by the import system in Xcode)
Your basic approach seems sound (and is pretty close to how I handle lots of vendor projects). Since you've added $(PROJECT_DIR) to your header search path, and assuming that the framework is in a directory named "Dropbox", then you can refer to the packages a couple of ways:
#import <Dropbox/Header.h>
#import "Dropbox/Header.h"
I prefer to think of the sub-projects as "system-like" and so tend to use angle-brackets, reserving double-quotes for internal code. But either approach is really fine.
Shouldn't the importing itself link the dependencies?
No. You still need to link the dependencies. #import does just exactly one thing: inserts the requested file into the current file. That's all it does. It is identical to you taking the referenced file and copy/pasting it into your code (that's basically how it's implemented in the pre-processor). That this is used for "header" files is a matter of convention. It has nothing to do with how the compiler works. You technically could import a .m file that included a method in it as a way to do code reuse. (I've seen that done in projects I've worked on. Please don't do this....)
When dealing with ObjC modules, it's a little different (using #import rather than #import). But if you're just importing headers as you seem to be, think of it as "stick this other file right here, exactly as written."

Including Google Analytics in Swift Bridging Header

This has actually been driving me crazy.
I've been following the instructions on the Google Developer's site (which doesn't actually have an import line, but if you inspect the element you can kinda notice that someone messed up and it's supposed to be #import <Google/Analytics.h>)
But Xcode just refuses to find the Google Analytics, while it imports the other header in my bridging header perfectly alright (e.g. it reads the file fine, but only does one of the imports).
My file looks like this:
#import <workinglibrary.h>
#import <Google/Analytics.h> // this doesn't work!
I've tried every variation of <Analytics.h> or "Google/Analytics.h" and so on. My header search paths looks fine too:
"${PODS_ROOT}/Headers/Public/Google"
"${PODS_ROOT}/Headers/Public/Google/Google"
"${PODS_ROOT}/Headers/Public/GoogleAnalytics"
...
Final caveat: I'm not sure (since Xcode doesn't fully build when I do this), but I think that Xcode properly imports the Analytics.h file if I comment out the #import <workinglibrary.h> statement (at least, I can Apple + Click analytics functions in other files to get to their declaration).
EDIT: just kidding that last bit isn't true
I had same issue. This has been fixed in cocoapods 0.38.2
To update use: gem install cocoapods
You can use_frameworks!
Seems like for the latest stable Swift/XCode/Cocoapods/GA it needs putting #import <GoogleAnalytics/GAI.h> into bridging header

external framework File/File.h (Parse/Parse.h) file not found

So every time I update my app, Xcode claims not to be able to find a particular external framework even though it's there. It's happened again with Xcode 6 and my usual methods (I'm fairly inexperienced, so these basically involve clicking and typing things until something happens (I exaggerate but not by much)) aren't working.
I'm getting a Lexical or Preprocessor Issue error that says 'Parse/Parse.h' file not found.' But here are screenshots of it in the project and added to the library:
I also followed the steps in the most upvoted answer at ‘ld: warning: directory not found for option’ but still nothing.
Any idea what to do? Any idea at all? I'm tearing my hair out here.
Actually I was facing the same problem but after doing lots of (removing/adding parse framework) efforts I come to know that parse.framework is already added and error was still there.
Real Problem was not in link Binary for main project but it was with Tests link Binary.
Lets say your project name is "project1" and Xcode create one more folder with it called "project1Tests". So select "project1Tests" and add parse.framework in link Binary.
Check out the hierarchy:
PROJECT
project1
TARGETS
project1
project1Tests (you need to select this to add parse framework).
Hope this would help you resolve this issue.
I had this error also. I'm developing in Swift, so I added a "bridge header" as described in this Parse blog post.
The reason I got the "Parse.h not found" was that my project name contained spaces. (For project name I mean the Product Name you enter when creating a new project, which determines your folder's name.) The first day all went well, but after closing and opening Xcode, it turns out that Xcode interprets the words separated by spaces as different paths.
To fix this, you can go to Build Settings -> Search Paths -> Framework Search Paths and add an "\" before each space. (If you double click the path you'll see that Xcode shows each word separated by space as a different entry.)
Also note that the bridge header with #import <Parse/Parse.h> it's not compulsory: you can simply do import Parse.
All I had to do was remove Parse.framework from this list by highlighting and pressing delete.
Then I went down to the plus sign at the bottom of that list and had to select Add Other and manually locate the downloaded .framework file.
In my case, the error went away after I added the path to the directory where Parse.framework was to the Frameworks Search Paths Build Setting:
My project didn't even have an entry for that setting, so you may need to create it as well.
I had the same issue when upgrading parse to 1.4v. You have to delete Parse.framework from Framework List and from the project directory, when removed from both places copy again and check "Copy items to destination's group folder". It worked for me.
Its work for me.
Just go to Build Active Architecture Only and Debug should be yes and Release should be No
In my case I had to do one more thing additional to Sukhchais' answer.
It seems that though the parse.framework appears in the 'link Binary with Libraries' list for the targets, they might not have linked properly for some reason. Just remove parse.framework from the list and add it again as mentioned. By that way I was able to resolve my issue.
Just to Share my findings in case if somebody might have the same issue:
Accidentally we had two references of Parse.framework inside our source code base at two different places. And a reference of Parse.framework was linked in Build Phases of the target, from the first place. But when the app is compiled, Xcode was not smart enough to get a reference and trowed an error: "Lexical or Preprocessor Issue" error when "Parse/Parse.h" is imported in .pch file.
After spending couple of hours by trying various options, removed a reference of Parse.framework from the source base and kept only a single reference. This solved the issue.
And the app compiled successfully :)
For people coming from Ionic + Cordova if you are getting this error I solved it by removing my current parsePlugin and replacing it with this fork.
For simplicity, I used these console commands (Replace PARSE_APP_ID and PARSE_CLIENT_KEY with your keys in the Parse Console):
cordova plugin rm com.parse.cordova.core.pushPlugin
cordova plugin add https://github.com/grrrian/phonegap-parse-plugin --variable APP_ID=PARSE_APP_ID --variable CLIENT_KEY=PARSE_CLIENT_KEY
Ok, so I was having this problem as well. I uninstalled all my pods, reinstalled them again, and had no luck.
So the good news (and bad news considering the time I spent trying to find the problem) is that I eventually managed to solve it. Apparently, you have to import Foundation/Foundation.h before parse. I don't know whether this will work for you or not, but I tried everything on the net, and only this seemed to work. If you have any instances of this:
#import <Parse/Parse.h>
#import <Foundation/Foundation.h>
flip it around so that Foundation is declared first:
#import <Foundation/Foundation.h>
#import <Parse/Parse.h>
I also read somewhere that some people had issues with Facebook SDK and Parse SDK import. Apparently, the two have Bolt.Framework in common or something, which causes error. I removed Facebook SDK as well, which at first didn't make any difference. I hope I could help.

How do I add classes found in the "extras" folder of QuickDialog?

With a recent update, some functionality of QuickDialog such as the QPickerElement was moved out of the main project and into an "extras" folder. What is the right way to add this functionality back into a project?
Took most of the day, but I finally think I have the correct way of doing this. In your project-Prefix.pch file, use the following code:
#import <QuickDialog/QuickDialog.h>
#import <Extras/QPickerElement.h> // Add a line like this for each of the extra classes you need
Also, make sure that the "User Header Search Paths" value in your target's build settings is set to recursive. If it isn't, you'll get an error saying something like: "QEntryElement not found".
Hope this saves someone else a lot of time.

Resources