Installing Reskit and libRestKit.a is missing (red text) - objective-c

I am following the RestKit setup instructions perfectly, but I am getting libRestKit.a in red in the Linked Binary With Libraries.
Install instructions:
https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x
I would try to drag the libRestKit.a file to my project, but cannot find it anywhere in the Restkit download?
Anyone run across this issue?
Running Xcode 4.5.2
UPDATE: See comments below. Now I am getting "File not Found" for #import

The solution is NOT to copy the "$(BUILT_PRODUCTS_DIR)/../../Headers" from any webpage. Type it out as Xcode didn't like the " copied and pasted. I just replaced the " copied and pasted with manually typed and it worked.

You can try to install RestKit using CocoaPods, then you include like this: #import "RestKit/RestKit.h"
check how to work with cocoapods and restkit here:
https://stackoverflow.com/a/13762665/1848750

If your getting the "File not found" error, check your project settings.
File > Project settings
Derived Data Location > "Project-relative"
Select "Advanced"
Select "Unique"
Clean & Build

The ".a" file doesn't exist until it's built. And if you followed those directions perfectly, I'm guessing you have embedded the RestKit project within your own project, yes?
Here is a image from the instructions; a critical step you need to do (provided you have properly added the RestKit.xcodeproj into your own project). You need to add the .a file (which doesn't exist yet, but will once it's built) as a target dependency to your own app.

Related

Why is my simple objective c bridging header failing to find the file "BraintreeCore.h"?

This is really frustrating me. I've integrated the Braintree library into several iOS projects before to be used in swift and never really had a problem but currently I can't get it to work.
I have followed/repeated the instructions here over and over:
https://developers.braintreepayments.com/start/hello-client/ios/v4
Specifically, i put pod 'Braintree' in my Podfile, ran a pod install and pod update, and have verified the Braintree library now appears in the Pods directory.
I have re made my bridging header 3 times now too, being careful to set the target to my app. I've also verified over and over that I have set the objective c bridging header in my Build Settings to the correct file, and have it succesfully creating bridging headers for other objective c files. Sadly though the following lines just aren't working in the bridging header:
#import "BraintreeCore.h"
#import "BraintreeUI.h"
They both give a compile error of the same type, saying BraintreeCore.h file not found.
I was able to do the following without getting an error:
#import "Pods/Braintree/BraintreeCore/Public/BraintreeCore.h"
But when I try and do the same for BraintreeUI.h like so:
#import "Pods/Braintree/BraintreeUI/Public/BraintreeUI.h"
It links me to the BraintreeUI.h file and tells me "BraintreeCore/BraintreeCore.h" file not found about this line in the BraintreeUI.h file:
#import <BraintreeCore/BraintreeCore.h>
What am I doing wrong?? this should be straightforward but it's been infuriating me for over 12 hours now.
Full disclosure: I work at Braintree on the iOS SDK.
Your bridging header should not need you to specify a path to the umbrella header files. This might indicate that your Xcode project's build configuration is set up so that Xcode's build system can't find the header files. In a typical project, you should be able to do this no problem.
My suggestion would be to take a close look at the Project > Build Settings > Search Paths settings. In particular, the Header Search Paths setting should contain one entry that looks like this:
"${PODS_ROOT}/Headers/Public/Braintree"
If it doesn't, I suspect that CocoaPods is not playing nice with your Xcode project. You may want to try de-integrating and re-integrating. Using CocoaPods 1.0, you should be able to do pod deintegrate, make sure your Pods/ folder is deleted, and run pod install. Worst case possibility, you may just want to start with a brand-new Xcode project and drag over your old source files (although that might be a big pain).
Did you find a solution, HelloCoding? Facing the same issue ...
In my case, I noticed that the Braintree documentation says "If your app is written in Swift but your CocoaPods integration does not use dynamic frameworks, you can import Braintree in a bridging header".
So I deleted the imports from the bridge file, and included a "use_frameworks!" instruction in my Podfile instead.
I have no idea whether this is the approved way to fix the issue, but it seemed to work for me.

Invalid Swift Support / The SwiftSupport folder is empty

Environment: Xcode 7 GM
I uploaded iOS app successfully using Xcode without error. This app is written in Objective-C and Swift.
However, immediately after successful upload, I got this email from Apple stating this error:
Invalid Swift Support - We have discovered one or more issues with your recent delivery for XXXXX(my app name). To process your delivery, the following issues must be corrected:
Invalid Swift Support - The SwiftSupport folder is empty. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
Once these issues have been corrected, you can then redeliver the corrected binary.
Anybody has a solution against this issue?
I have already confirmed below issues.
"SwiftSupport/iphoneos/" libraries in archives(.xcarchive file) is equaly to "Products/Applications/myApp.ipa/Frameworks/"
My "Valid Architectures" setting is "$(ARCHS_STANDARD)" displaying "armv7k".
Provisioning profile is set to Dev and Release which has been created in iTunes connect, respectively.
And, in my "Edit scheme", Test target is unchecked at Archive.
important note: this only works for projects that do not use swift, see comment below
I just met the same issue and resolved it by making the following change -
If you used to have Swift files in your project but then removed them, you only need to set "Embedded Content Contains Swift Code" to NO in Build Options.
when try to export after "Xcode->Product->Archive"
you should choose "save for ios app store deployment" option
The same problem confused me a couple of days,
the above setting can solve this problem.
no matter "embedded content contains swift code" is yes or no.
There are many conflicting answers on this page.. what worked for me was the one mentioned here, which is simply select a save for iOS app store deployment option (I'm actually not interested in an app store release.. I want to simply push a release for testflight internal testing)..
that being said, I have a way to verify that your ipa will be approved or not before submitting it:
drag the .ipa file into a new folder (call it analysis)
right click the ipa file and rename it to .zip (confirm the dialog to use .zip)
double click the zip file
here if you get a folder (with the same name as the .ipa file) that has the following subfolders in it:
payload
swiftSupport
Symbols
then you are good to go, however if you only see the Payload folder within.. then you gotta try again
also a couple of pointers
I've tried setting "Embedded Content Contains Swift Code" to NO, it worked just once then stopped working after that
I've ensured that I had no cocoapod errors.. that didn't help either
I've tried manually adding the SwiftSupport folder inside the archive as suggested here.. but then i got all sorts of side effects.. didn't work
conclusion
I think this is due to some bug with xcode (writing this with Xcode 8.0 build (8A218a).. so keep on trying your luck until it works.. just don't expect some solid explanation for it
Five Step Solution:
Go to build settings and make flag Embedded Content Contains Swift Code -> YES, if your code contains partial swift code or entirely made in Swift
Archive your build using Xcode->Product->Archive
Export the Archive Build you will suddenly see the difference build size will be 40+ MBs this is because XCode has added SwiftSupport folder which was missing
Now upload this build using Application loader
If this does not work check that if you have multiple XCode on your system goto
Xcode->Preferences->Location->Command Lines Tools has the same latest or the same Xcode from drop down selected on which you have done the coding & vola it's done.
This is slightly a drawback as swift carries the baggage and has to be compatible with earlier version and Objective C code.
My many hours were wasted hope you will find this helpful ;)
This error can happen if you use xcodebuild to export the IPA without specifying the -exportOptionsPlist option
See xcodebuild -help for the available keys, but you probably want a plist with at least the method key set to "app-store", like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
</dict>
</plist>
I spent almost an entire day on this issue, none of the above solutions worked. I got rid of this error by lowering my target tvOS back to 11 from 13; where it was originally. That restored the SwiftSupport folder. The question that remains to be answered is whether this is due to our Provision not allowing us to target tvOS 13 - or somehow the Apple Store folks not being aligned with the xCode folks because the app created by targeting tvOS 13 is 14mb and tvOS 11 is 44mb and different app folder structure.
I received this same email after uploading an .ipa file to App Store Connect through the Transporter app. The following is where I went wrong: I distributed the app using ad hoc.
The following steps are the solution for my error:
Archive app
Distribute on TestFlight and the App Store
Export
Open ExportOptions.plist in the newly created folder from the export.
Make sure the method property has the value app-store if you are uploading to App Store Connect/TestFlight like me.
Drag and drop the exported .ipa file to Transporter.
Deliver your app to upload it.
And that's it!
I grappled with this for several hours and here is what worked for me.
In the Archive, Xcode did not copy swift libs into SwiftSupport/iphoneos even though my project had "Embedded Content Contains Swift Code" set to yes for all targets. Nor did it copy swift libs into "AppName.app/Frameworks". So I had to do that manually in the Archive before submitting:
copy "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/lib*" to "Archive_folder/Products/Applications/AppName.app/Frameworks" and "SwiftSupport/iphoneos"
If your app also has a watch app
copy
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos" into "Archive_folder/SwiftSupport/watchos" and "Archive_folder/Products/Applications/AppName.app/Watch/AppName WatchKit App.app/Frameworks"
Then submit the app.
App Store build submission Issue:
Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.
Solution:
In most cases we found this issue due to submitting application via App Loader and our usual practice to make ipa as Organizer > App Archive > Show In Finder > Show Package Content > Products > Applications> OurProjectName.app in copying this app to Payload folder and zip it and making ipa file to submit on App Store using App Loader. That is work fine for submitting only objective c files contained projects.
But there is some changes if your project contains any swift classes and usage of it. If your project contains swift classes with Objective C project, IPA content structure changed slightly different as attached screenshot.
To fix this issue, submit app directly from Xcode [ OR ] if you want to submit application via App Loader than first Export ipa using Export option from Xcode organizer and submit those ipa file to app store via App Loader.
See the reference screenshot as below:
Hurrey!!! Your issue will be fixed :) :) :)
My problem was that I was using an adhoc profile to submit to TestFlight (has to be a distribution provisioning profile). Great error messages Apple!
This happened to me after I changed project settings.
Go to "File" > "Project Settings..." (or in some cases "Workspace Settings...") and then select "Use Shared Setting" from the "Build System" dropdown.
Tried this solution with Xcode 11.6, in Aug 2020, and it works.
Select the archive > Show in Finder
Show Package Contents
Delete the folder SwiftSupport
Go back to the archive > Distribute App
Setting "Embedded Content Contains Swift Code" to $(inherited) worked for me.
The warning after executing the CocoaPods command pod install helped me to find this out.
[!] The `applewatch Extension [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-applewatch Extension/Pods-applewatch Extension.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or <--------------
- Remove the build settings from the target.
Using Save for iOS App Store Deployment instead of Save for Ad Hoc Deployment Xcode export option solved this issue for me. Counterintuitively, you should use the first option even for TestFlight builds.
You also get this error when you upload an ipa that has a plist with export_method set to ad-hoc instead of app-store to itunes ...
Here's what I am doing now to solve this issue since my method above stopped working. Keep in mind that my code's main app is Obj-C and my watch app is Swift.
Make sure the "embedded Content Contains Swift Code" is set to:
YES for app target
NO for WatchKit Extension
YES for Watchkit App
After Archiving my XCode will not create the "[archive folder]/SwiftSupport/iphoneos", but will create and fill the "[archive folder]/Products/Applications/[app name].app/Watch/\ WatchKit\ App.app/Frameworks" with the Swift dylibs. So I created the following soft link:
ln -s "[archive folder]/Products/Applications/.app/Watch/\ WatchKit\ App.app/Frameworks" "[archive folder]/SwiftSupport/iphoneos"
Then when I submit via XCode Organize it is accepted without error.
If you simply copy the files rather than linking them then you risk the watch app exceeding the 50MB limit.
Setting Always Embed Swift Standard Libraries to Yes is only necessary for Objective-C targets which link against your own frameworks which depend upon Swift. In cases where you are not linking against (i.e., using) an internal framework which depends upon Swift, Xcode will embed the Swift standard libraries in your archive as long as there is at least one occurrence of importing a Swift standard library in a Swift file which is part of the build target.
In other words, if your target has a Swift file which doesn't import any Swift standard libraries––via "import Foundation", for example––then Xcode will not copy the Swift Standard libraries into the archive.
The fix for this issue is to ensure that at least one of the Swift files in your target is importing a swift standard library (e.g., "import Foundation").
Daniel Jalkut has a very informative post about Swift dependencies which sheds light into this issue.
I grappled with this issue for a while and nothing above worked. In a last desperate attempt I just deleted the SwiftSupport folder from my archive.
To my surprise it uploaded and completed processing successfully. Hope this help someone.
I managed to fix this error by unchecking the option "Strip Swift symbols".
App Store Connect distribution options
To delete the SwiftSupport folder from the .ipa I used the following script
ipa_path="${DIR_ON_CI}/ipa_name.ipa"
zip -d "${ipa_path}" "SwiftSupport*"
You'll need to set proper ipa_path. Nothing else seems to work in my case and the app was built on a CI where I have access to the .ipa after the archive is exported.

XCode 6.0.1 error when creating project: The file "exclude" doesn't exist

When I create a new project in XCode 6.0.1, I got this error message: The file "exclude" doesn't exist
It seems to only impact the versioning of the files i.e. the generated stub files are not committed into github after the project is created.
What can cause this problem?
For me the issue was caused because I had previously created a project with the same name, and Xcode still had record of that.
To clear it out,
go to Window -> Organizer in the menu bar
Remove all of the repositories highlighted in red
To add your repository (if it's not being tracked for some reason),
Click the + (still in Window -> Organizer from the steps above)
Enter the path of your file
Make sure to change to Git from Subversion (if Xcode has Subversion set as default - it did for me.
I usually get this error if I initialize an Xcode project with a git repository, delete it and try to recreate it with the same name (casing doens't appear to make it sufficiently 'different'). Turns out, "Well I'll just start over" can leave some issues as well.
Hope this helps.
I had this issue as well, and I tracked it down to the .git-template folder included with Thoughtbot's dotfiles. Basically, Xcode expects its template folder to have info/exclude, and Thoughtbot's dotfiles don't. Creating that directory and file fixed the problem, as so (in the Terminal):
cd ~/.git_template
mkdir info
cd info
touch exclude
If you're getting this issue without Thoughtbot's dotfiles, you could probably look at ~/.gitconfig and use whatever templatedir is getting set as instead of ~/.git_template in the first command.

iOS UI Test Project 'MailCore/MailCore.h' file not found

I did a
git clone https://github.com/MailCore/mailcore2.git
I open the
iOS UI Test.xcodeproj
I run the Build
I get the error
'MailCore/MailCore.h' file not found
I cannot understand why that is happening.
What should I do to get this to build?
Some other sources I have found and followed their instructions are below. None of which fixed this problem.
https://github.com/MailCore/mailcore2/issues/316
https://github.com/MailCore/MailCore/issues/19
https://github.com/MailCore/mailcore2/issues/276
I also was able to open the
mailcore2.xcodeproj
and successfully build each of the targets. Which is interesting that I can do that but cannot build the test project independently.
I also followed the video and read me instructions to add to an existing project and was able to build until I added the
#import <MailCore/MailCore.h>
to one of my files.
UPDATE:
The above process I initiated on my iMac.
On my MacBook Pro after I cloned mailcore2 I opened
mailcore2.xcodeproj
first then did the build on each of the targets.
Then I closed that project.
Opened the iOS UI Test.xcodeproj and did a build on that.
This was successful.
However, I still want to know what would cause the problem with the "file not found"
UPDATE 2:
I removed to trash all mailcore2 code from my iMac.
I created different locations in Finder for doing another clone of mailcore2.
I did the git clone.
I opened mailcore2.xcodeproj
I followed the exact same process of building each target like I did on my MacBook
I then opened the iOS UI Test.xcodeproj and did a build.
I get the same problem of
'MailCore/MailCore.h' file not found
Makes no sense to me how it works on macbook but not on iMac.
You can add in target dependency static mailcore ios(mailcore2).
and add the framework libmailcore-ios.a
Its working.
What I finally did was drop mailcore2 into an existing app I already had started.
To do this I did the following:
I removed all traces of mailcore2
I again followed the instructions in the README and the video help.
This time I followed some instructions from
https://github.com/MailCore/mailcore2/issues/276
The instructions in that link says to add the following to Library Search Path:
$(PROJECT_DIR)/mailcore2/Externals/ctemplate-ios/lib
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator
And the Header Search Path to
$(PROJECT_DIR)/mailcore2/build-mac/build/Debug-iphonesimulator/include - recursively
But, that did not work for me. I had to add the HARD CODED PATH to each of those 3 folders.
After doing a clean and build I was then able to add the
#import <MailCore/MailCore.h>
Now it BUILDs completely without error for me.
I will go back and try to add proper relative paths to each of those Search Paths.
Hopefully this helps somebody else with same issue.
FWIW
Had same problem, spend hours trying - nothing worked, not ever hardcoding paths.
Then I stumbled on one issue:
if in XCode\Preferences\Locations I go to Derived Data - Advanced and set it to different locations it always reverts it to Unique, when I go back and check it.
Then I went in File\Project Setting to Derived Data - Advanced and there it was set to Unique. I changed it there to Default and now it does not have that issue anymore!
I delete Derived data, clean project and Start build (Ctrl+B) and I can see now how Build is being created in derived data w/o problems. And that what mailcore needs to function.
And, I checked - no need for hardcoded paths either!
Hope it helps somebody.
PS Another feature maybe useful too - XCode\Preferences\Continue building after error though it did not matter in my case

What should I do if I can't find the GPUImage.h header for the GPUImage framework?

I have created a sample application to perform bump distortion, using the GPUImage framework. I added this framework to my application, but I'm seeing the following error
Lexical or preprocessor issue 'GPUImage.h' file not found.
I have added the -ObjC flag to the Other Linker Flags, but I'm still seeing this error. How can I solve this problem and get my application to compile?
Adding GPUImage framework to XCode project could be tricky. So I haved added detailed step-by-step instructions w/ images on how to do it.
Static Compilation Method (detailed solution so we don't mess up)
This is Static compilation method. In this basically we will compile the framework using ./build.sh file. And simply add it to our XCode project, then configure XCode to properly use it.
Download GPUImage from Github and extract it (or just clone it).
Go to the GPUImagefolder in terminal
Run ./build.sh
Note: This will compile and create ready-to-use binary for all the sdks on your mac.
build.sh creates a folder called build and generates compiled binaries and dumps them to folders like: Release-iPhone, Release-iPhoneOS, Release-iphonesimulator etc folders.
For iPhone use Release-iphone (This also works for simulator).
Copy (not drag-drop) Release-iphone to your XCode project's root directory so that we have a local copy of framework.
Now iPhone drag-and-drop Release-iphone onto your XCode project. Make sure to check "Copy to .." option.
Note:
This Release-iphone folder contains two sub-folders: include and lib
include folder contains all the header .h files
lib folder contains compiled binary version file called libGPUImage.a
We now need to simply configure XCode to use .h and .a files.**
Select your project in the project explorer > Project name under Targets > select Build Phases > Expand Link Binary With Libraries
Add the libGPUImage.a to Link Binary With Libraries section. You may want to Right-click on libGPUImage.a then Open in Finder and finally drag-drop it.
While we are at it, also add the following GPUImage's dependent frameworks/ libraries
CoreMedia, CoreVideo, OpenGLES, AVFoundation, QuartzCore to Link Binary With Libraries section
Now, lets configure .h headers.
Select your project in the project explorer > Project name under Targets > select Build Settings > and type search paths to see search paths section.
Open Headers Search Paths by clicking on the value field.
Drag-and-drop the lib folder to that popup. Note: If it shows absolute path, change it to looks $(SRCROOT)/path/to/lib/. (You should have the framework relative to your xcode project see step 6).
Repeat 11 & 12 for Library Search Paths as well.
Additional tips: You can add .h files to Library Search Paths or Headers Search Paths, you can make them Recursive. I have a main root-folder called Dependencies folder where I keep all the dependencies like MySDK-framework including Release-iPhone. And I just have one search-path at the Dependencies (root folder) and made it recursive.
Did you follow all of the instructions from the Readme on the project page? From the installation instructions:
You'll also need to find the framework headers, so within your
project's build settings set the Header Search Paths to the relative
path from your application to the framework/ subdirectory within the
GPUImage source directory. Make this header search path recursive.
If you're seeing the above error, it means that you did not point the Header Search Paths at the right directory where you've installed GPUImage relative to your project, and / or did not click the checkbox to the left to make those search paths recursive.
I show some screenshots of where you need to go to set this in this answer, which explains something similar for the Core Plot framework. The same principles apply, only you need to find where you installed the GPUImage framework at.
I add relative path to "Header Search Paths", but there is still a error that is "not found".
Then, I add path to "User Header Search Paths", and it works.
May help you.
finally, I realized the KEY WORD is relative!
I put GPUImage source files in my project root dir:
before I solved the problem, I add Header Search Paths is:
$(PROJECT_DIR)/GPUImage/framework
$(PROJECT_DIR)/GPUImage/framework/iOS
and make them Recursive, but error is still there, So I changed Paths to:
GPUImage/framework and make it Recursive, then it works.
Hope it helps.