How to integrate RestKit Framework (restkit.org) with xCode 4? - iphone

I followed the instructions on the github page but something is wrong (most certainly is me: P) but, Do you know about any good tutorial for integrate / use in Xcode4 RestKit?
Thanks!

Download the latest version from this Link http://restkit.org/
and extract the zip folder and you will find a ReadMe.md file which explains you steps to install for Xcode 4.x as shown below
Xcode 4.x (Git Submodule)
Add the submodule: git submodule add git://github.com/RestKit/RestKit.git RestKit
Open the project you wish to add RestKit to in Xcode.
Focus your project and select the "View" menu > "Navigators" > "Project" to bring the project file list into view.
Drag the RestKit.xcodeproj file from the Finder and drop it on your "".xcodeproj.
Click on your project's name in the sidebar on the left to open the project settings view in the right pane of the window.
In the middle pane you will see PROJECT and TARGETS headers for your project. Click on your project name, then select Build Settings along the top to open the Build Settings editor for your entire project.
Find the Header Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build" directory you have added to your project. DO NOT check the Recursive checkbox.
Find the Library Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build/$(BUILD_STYLE)-$(PLATFORM_NAME)" directory you have added to your project.
NOTE: This is only necessary if you are NOT using DerivedData.
Find the Other Linker Flags entry and double click it. Use the + button to add a new entry and enter -ObjC -all_load. Dismiss the editor with the Done button.
Locate the target you wish to add RestKit to in the TARGETS list in the middle of the editor pane. Select it to open the target settings editor in the right pane of the window.
Click the Build Phases tab along the top of the window to open the Build Phases editor.
Click the disclosure triangles next to the Target Dependencies and Link Binary with Libraries items.
In the Target Dependencies section, click the + button to open the Target selection sheet. Click on the RestKit aggregate target (it will have the bulls-eye icon) and click the Add button to create a dependency.
In the Link Binary with Libraries section, click the + button to open the Library selection sheet. Here we need to instruct the target to link against all the required RestKit libraries and several system libraries. Select each of the following items (one at a time or while holding down the Command key to select all of them at once) and then click the Add button:
libRestKitCoreData.a - Optional. Only necessary if you are using Core Data.
libRestKitJSONParserJSONKit.a
libRestKitNetwork.a
libRestKitObjectMapping.a
libRestKitSupport.a
CFNetwork.framework
CoreData.framework - Optional. Only necessary if you are using Core Data
MobileCoreServices.framework
SystemConfiguration.framework
libxml2.dylib - Optional. Only necessary if you are mapping from XML payloads and link libRestKitXMLParserLibxml.a into your app.
Verify that all of the libraries are showing up in the Link Binary with Libraries section before continuing.
Congratulations, you are now done adding RestKit into your Xcode 4 based project!
You now only need to add includes for the RestKit libraries at the appropriate places in your application. The relevant includes are:
#import <RestKit/RestKit.h>
// And if you are using Core Data...
#import <RestKit/CoreData/CoreData.h>

I found this tutorial very useful to make it work on xCode 4.0.
http://liebke.github.com/restkit-github-client-example/

I did my build following this steeps https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x and guoleii is right. But I needed to change the owner directory.

Have you seen this threads from RestKit's Google Group?
link 1
link 2
Try searching there. But for now, there seems to be A LOT of issues with RestKit and Xcode 4, there's even a YouTube video showing the problems (none showing a how-to).

did you build RestKit according to the wiki page "Installing RestKit in Xcode 4.x" on github.com/RestKit? i think there is a little mistake. here is my solution: 1. in "Build Phases" -> "Link Binary With Libraries", delete the RestKit.framework and add Security.frameWork 2. build again
then it works.

I just tried to install RestKit on a newly created Xcode 5 iOS 7.0 project. I tried downloading the project and following the steps above, but i was missing most of the content with in the RestKit/Vendor folder. After doing a bit of research i did the submodule tactic and that got me all of the information from those folders.
From the command prompt change directory into your project folder, for me it was
$ cd Documents/Projects/NewlyCreatedApp
From there you should run this command if you have no git repository
Note: you must download git to install this, if you have not already
$ git init
after that you must run these commands to download restkit into your project folder
$ git submodule add git://github.com/RestKit/RestKit.git
$ git submodule update --init --recursive
After that, you should go up to Nakkeeran's answer above and start from step 2, to set up the process. In step 7 you will be asked to add "$(SOURCE_ROOT)/RestKit/Build" to your header search paths, but upon closer inspection the RestKit framework no longer has the build folder so you should change that to "$(SOURCE_ROOT)/RestKit/Code" to fit the current version of Rest Kit
I hope this helps, and here is a link to the submodule information i posted.
RestKit Installation Submodule Method

Related

'Build input file cannot be found' Swift 4.2, Xcode 10.0

I am getting the following error when building in Xcode 10.0 with swift 4.2:
Moving the folders around the inspector can cause the error "Build input file cannot be found"
SWIFT 5
In Swift 5, the error came up but the identity showed no errors.
Go under build settings and select packaging.
Delete the current paths for Debug and Release and enter your new path where the info.plist is kept.
For example [APPROJECTNAME]/[THEINFOPLISTFOLDER]/info.plist
In the screenshot below, the path is API-client/Resources/info.plist
SWIFT 4
To fix it, go to the general tab and under identity reselect the info.plist that you like
Build input file cannot be found
How To fix This issue :
Go in the project-navigator, select your project
Select Build Phases tab
In Compile Sources section, check for the file(s) that Xcode is demanding of
Notice that the file(s) have the wrong path, and delete them by clicking on the minus icon
Re-add the file(s) by clicking the plus icon and search in the project.
Product > Clean Build Folder
Build
A most common error when you move Info.plist in another folder.
To fix this error you can select the Info.plist and choose Relevant to Project from file inspector.
Next step, go to Build settings and search for info.plist and fix the file path.
I got this issue after resolving the conflicts in project.pbxproj.
Step 1: Removing the "Build input files cannot be found" files from BuildPhases -> Copy Bundle resources and adding them back worked for me.
If the above Step 1 doesn't work, search for "Recovered References" folder in your project structure and remove the files that are causing this issue and repeat Step 1
For build file missing i.e. info.Plist :
Under Project navigator,
select(click) Project name and icon,
In middle pane, click target
click blue General tab on top
click / Targets
click [Choose info.plist File] button
in pop-up window, select the info.Plist file
I had the same problem with a missing view controller file that couldn't be found after cloning a project in a new folder. I deleted the view controller but the compiler continue asking for a file in a path that doesn't exist anymore.
I solved the problem as follows:
Select the project target in the Project-navigator,
Go to Build Phases tab
In Compile Sources section, check for the file that the compiler is asking for. You can filter by the name at the top right of the screen.
The deleted file is still on the list with a wrong path, delete it by clicking on the minus icon. You have to do it for all the target you may have.
In the case that you still use the file, add it on a new path by clicking the plus icon.
Clean Build Folder in the Product Menu.
It should work now :D
(Objective-C Project / Xcode Version 10.2.1 (10E1001))
This works if you get the 'Build input file cannot be found error message' and also have files that are red in the inspector:
Open your project folder in Finder
Make a copy of the affected files onto your Desktop
Delete the affected files in Xcode and then close Xcode
Re-Open Xcode and drag your copied files into your Xcode project
This worked for me. Before I got the error message I was re-organising files in the file inspector which gave me that error message and made the files I was moving around turn red. Hope this helps !!
I tried going to Compile Sources in the Build Phases tab and deleting and re-adding the selected file (and cleaning and rebuilding)but it didn't work :( Instead, this following answer worked for me if you get the 'Build input file cannot be found' error message:
Delete the affected files in Xcode (I right-clicked->Delete'd in the Navigator)
Re-add the affected file (mine was .mlmodel) and I selected "Copy items if needed" under Destination.
Cmd-shift-k to clean and then Cmd-b to build
and voila! The file was recognized and error gone!
Hope this helps!
For me this worked:
Click the app name under TARGETS
Build Settings -> Packaging -> Info.plist File
There change the file location of the Info.plist File to the new location.
DemoApp/Info.plist to DemoApp/Assets/Info.plist
I got this error when I moved my Info.plist into a folder.
When I took Info.plist out of the folder, I no longer got an error.
Change the build setting to legacy
First, open your project in XCode by double-clicking on ios/<YourApp.xcodeproj>
Then go to File > Project Settings...
Change the Build System to Legacy Build System in Per-User Project Settings:
Select general tab and under identity select the info.plist you want for your development
For me something totally different worked:
Go to Target>Build Settings>Architectures
My valid architectures before: arm64 arm64e armv7 armv7s (Defaults)
Changed it to: armv7 i386 arm64 armv7s
In my case I got this error when I renamed a ViewController name using Refactor. The view controller name occurrences were changed but the real file not.
I tried to do what #ajji said but it didn't work. So I changed the name of the real file. After that all worked like a charm
If your file(s) - that couldn't find - icon color is pale. And you right click on it and "Show in Finder" does not open Finder. It means your file name is not same as what you see in the Navigator.
to Solve it, go to where your file exist, and change its name to be same as what you see in the Navigator.
I also faced same issue while building my xcode project - "Build input file cannot be found:"
Cause: I renamed my entire project but not the build setting.
Solution: In my project's build setting--> Packaging, I updated the path of the info.plist file. Now working fine.
If all else fails:
In Xcode. Remove references of files in question from your project.
Open your project.pbxproj file as a file in Xcode. This is in .xcodeproj
Delete all lines containing the name of said files. Save.
Back in Xcode. Re-add files to your project in Xcode.
In my case the file wasn't at the right path, Xcode was expecting to find the input file at a path like /Users/Malloc/Projects/MyProject/Info.plist while in reality the file was located at a different path like /Users/Malloc/Projects/MyProject/Subfolder/Info.plist.
A quick fix to this is to simply right click on the file then select Show in Finder, then drag the file to the correct path Xcode is expecting.
I got this error when i renamed a ViewController name using "Refactor". The view controller name occurrences were changed but an old reference was somewhere still existing.
Deleting derived data & Clean build folder worked for me.
Here's how to delete Derived data:
File>Workspace settings> Click arrow & remove all folders inside Derived Data.
In my case, it was due to localization.
Here's how to fix it.
How to localise a string inside the iOS info.plist file?
Update for Projects w/ Swift Packages
How did the errors happen?
I ran into this issue when I had imported Swift Packages into my project but later cleaned DerivedData to fix an unrelated app caching issue. My existing project was not a local Swift Package but an iOS app project.
Note that we can still encounter the same issue in local Swift Package projects.
What is the reason for the errors?
Swift Packages are checked out into DerivedData and are not referenced from the ModuleCache.noindex subfolder. Thus, cleaning the app's folder in DerivedData or DerivedData itself breaks dependency resolution within Xcode for Swift Packages.
This is a misleading build error since there may be nothing wrong with the app code you've written or your dependency resolution graph. The only thing required is to refresh the dependencies.
How can I resolve the build errors?
Xcode now has nice options within the IDE itself to resolve Swift Packages. These options trigger a new checkout into DerivedData:
We can use three options, as shown in the image above depending on our use case:
Reset Package Caches: Trigger a re-install of your existing Package dependencies w/ same versions.
Resolve Package Versions: Use this option for updating Package checkouts when fixing Package Versions for cross-compatibility (in Project Settings).
Update to Latest Package Versions: Use this to update all Swift Package dependencies to the latest versions. This option may be a local breaking change if the API changes.
NOTE: Apple's documentation recommends to use Xcode for dependency resolution when working with Xcode projects excluding CLTs.
Other solutions
We can also fix the error by restarting Xcode, but I find this step breaks my workflow and is tedious.
If we are running from the command line (local Swift Package executable), we can stick with a swift build variant without jumping to Xcode at all (Source). swift build doesn't work as easily out of the box in other projects, however.
Use xcodebuild:
xcodebuild -resolvePackageDependencies
I prefer staying in Xcode for simplicity but YMMV.
Goto Project Navigator.
Click on project.
Click on Targets.
Goto Build Settings.
Search Prefix.pch.
Change the location of this file (input the updated location).
This will resolve the issue as mine.
Had the same problem with swift files. Select files that are not recognised and Delete with Remove Reference option. Right click in the folder and Add files again.
In some cases, if you Refactor your existing ViewController files or any other files using right-click -> Refactor option within the Xcode workspace then on compiling this error will come since the File name is not changed in original place but reference is updated, so in that you need to also manually change the old file to new name.
When I checked out the code first time from the Git I faced the same issue for few pod file. Updating the pod file solved my issue.
Open the project folder in the terminal window
Run 'pod update'
Clean the XCode and run.
I just had to open the project in finder and drag/drop the appropriate files in the project folder
Build input file cannot be found
How to fix this issue?
My Approach:
1.From Project Navigator ->Files ->Add Files to Lowes ->In Finder View, check to which folder this lost referenced file is moved
to and check with your team members if anyone moved it for a reason.If it occurred by mistake
then follow below steps
2.From Project navigator, directly tap on the file which is causing issue.This is the same file that XCode shows as not found in
error .So clearly this file has lost reference and we need to
restore it back
3.The Swift bird folder icon appears in light red color which is an indication of lost reference
4.Right click on it and Delete it
5.Next from Project navigator -> Files ->Add Files to Lowes -> Finder View go to the folder where this referenced file is moved to
and tap on ADD button in popup window
6.Now if you look at the Project Navigator this file swift bird icon appears in bright red , but you will also find an extra file
with the same name at the top of the Project Navigator
7.Make sure you have this file in the right folder if not move it to right folder
8.Now right click to delete the very top redundant file, here do not select " Move to Trash" option.Just select "Remove References" option
This fixed my issue.
Adjust the file path according to that provided in the Xcode Error
My issue was a missing SettingsController file.
I copied a file from projectA to projectB but forgot to tick Copy items if needed. Unbeknownst to me a couple of weeks later when I deleted projectA the SettingsController file in projectB got deleted along with it. Afterwards in projectB the error Build input file cannot be found ... path/Folder/toSomeFile was shown.
To fix it I closed Xcode, went to the main folder that it was in, opened the folder and right clicked on the blue Xcode icon with the extension .xcodeproj, then I choose Show Package Contents
From there I double clicked on the project.pbxproj icon
Once the project.pbxproj file was opened I pressed command+f and in the search field I entered the path part of the error path/Folder/toSomeFile
It took me to 1-2 lines of code that looked like this
Once I deleted those 1-2 lines, when I went back to the projectB and opened it the error was gone.
Just for a little more clarity the exact path of the error was whogotgame_42/whogotgame/Controllers/SettingsController.swift. So that is what I exactly entered in the project.pbxproj search field to get to those 1-2 lines that you see in the picture.
I got this error when I put the Info.plist file inside a folder. Then when I extracted the file to public view, the error went away.

Three20 HEADER_SEARCH_PATHS strange behaviours

In one of my Three20 project, I have the HEADER_SEARCH_PATHS
HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/../three20 $(BUILT_PRODUCTS_DIR)/../../three20
But according to this: https://github.com/facebook/three20
I have must the following line in the path..
../three20/Build/Products/three20
I have re-created a project using ttmodule.py and confirm ../three20/Build/Products/three20 is the default but I am not sure why my existing project left it out.
Now the issue is:
Q. Why the project can build without error (Simulator/Device), what do you think is the reason?
in pre xcode 4 days the build folder would be under the project source directory which made sense to add a search header in a relative manner.
Three20 copies the header files into a specific place as part of a copy build phase.
Since xcode4 is out the build directory moved completely out of the project source tree into a temporary place configured as $(BUILT_PRODUCTS_DIR).
The reason you see 2 directories is because xcode generates 2 different paths for Archive builds and all the other kinds of builds (Run/Debug etc...)
$(BUILT_PRODUCTS_DIR)/../three20 $(BUILT_PRODUCTS_DIR)/../../three20
Notice that the manual instruction tells you to find that directory but it doesn't tell you where it is:
Finally, we need to tell your project where to find the Three20 headers. Open your "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click it. Add the relative path from your project's directory to the "three20/Build/Products/three20" directory.

Sending email in an iPhone application

I am getting this warning
MessageUI.framework/MessageUI, file was built for unsupported file format which is not the architecture being linked (i386)
What does it say ?
I have added the Message Framework by drag and dropping to my resources folder (I also selected the tick where it says copy the files or something). Is this the correct way to add a framework ? I tired R-clicking the resource folder, but I couldn't find any menu option that says add framework or anything similar. (I am using xcode 4.2)
you should add the framework through target setting, under build phases, under link binary with libraries, add messageUI.framework there, DO NOT drag and drop and COPY into the resource folder.
You have to manually add MessageUI framework in your project.
To do that follow this step:
1) Click on your main project --> Go to Target ---> Select Build Phases --> Select Link Binary With Libraries.
2) Click on + sign and add framework named MessageUI.framework.

Build dependencies and static libraries in Xcode 3

I'm trying to get the example project for an SoundCloud API wrapper working using XCode 3. There are some few basic instructions at the start, but I'm having trouble:
QuickStart
In your terminal:
git clone
git://github.com/soundcloud/cocoa-api-wrapper.git
SoundCloudAPI cd SoundCloudAPI git
submodule update --recursive --init
In your Xcode project:
drag SoundCloudAPI.xcodeproj into your project
add it as a build dependency
add the static library as
a liked target
add "[relative path to
SoundCloudAPI]/Sources/SoundCloudAPI"
to your header search path in the
build settings
you can also include
the OAuth2Client headers by adding
"[relative path to
SoundCloudAPI]/Outsourced/OAuth2Client/Sources/OAuth2Client"
too (although you might not need
them)
I've completely ignored the part before In Your Xcode project. I think I've done everything correctly to add the build dependency following this post, the frameworks are still marked in red as if they were missing. Any advice?
Also the three points after that are also not very clear? Could someone explain these in a bit more detail? For example, where is the header search path? and where are the build settings?
Thanks so much!
Tip: Given that you've tagged this question with iphone, I'll assume you're building an iPhone app. In that case, you need to add libSoundCloudAPI.a as a direct dependency, but not SoundCloudAPI.framework.
To set the header search path in Xcode 3:
Ctrl-click your app's target (inside Targets in the Group & Files panel on the left hand side) and choose Get Info
Click the Build tab - these are the build settings! :-)
Set Configuration: to All Configurations, Show: to All Settings
In the Search Paths section, update Header Search Paths

linking gdata to an xcode 4 project

I'm having major issues linking gdata to a project after upgrading from xcode 3.2.5 to xcode 4. I would like to know if anyone is having similar issues, and what did they do to resolve them. i am using gdata version 1.11 which is the latest on their site. The project works flawlessly on 3.2.5, thanks.
I have created a workspace for my project, and then added the gdata.proj to it. So I do have all the files linked by reference. But project files which include #import "GDataYouTube.h" do not see the file. I get "No Such File or Directory"
Good News... resolved and tested, all working follow these steps...
Open your project in xcode 4 from 3.2
click File -> Save As Workspace
in project navigator on the left, collapse your Project if you see all the files
below your collapsed project, in the empty space right click or control click -> Add Files to...
select the project file you wish to link to, leave Copy items unchecked, click Add
Now you will see 2 collapsed projects in your Project navigator, expand both
Now what I didn't know I had to still do
Drag the files or folders you want from the second project to your main, make sure your Main project target is selected in the options, and I also have group selected then click Finish
You are good to go, you might have some warnings about your second project and its targeted SDK. Fix those by clicking the project name in the Project Navigator -> Build Settings -> Base SDK to 10.6, Deployment Target to 10.5