Xcode GIT problems iPhone App - iphone

So I made a repository for an app and everything in Xcode is setup. Now another person tries to pull it and that works fine until this message appears: The File "UserInterfaceState.xcuserstate" could not be unlocked, unlocking failed for an unknown reason.
The project uses the Google Maps API and gives the error: "GoogleMaps/GoogleMaps.h" file not found. Even though the project is a direct clone, it works for me but not for him.

For the error of "GoogleMaps/GoogleMaps.h" file not found.
You may have not set the path properly. For setting right path do following steps:
Go to Targets -> Build Phases -> Link Binary With Libraries
Click on + option
Select the GoogleMaps Framework. If you have added it from outside than go there & select it.
Go to Targets -> Build Settings -> Header Search Paths
Remove the older path of Google Maps API from it (keep new path don't remove it)
For "The File "UserInterfaceState.xcuserstate" could not be unlocked" issue
refer this : http://www.meetup.com/818-iOS-Developers/messages/boards/thread/20469352

You probably corrupted the file by using Git, that, or you overwrote a locally saved file with something from the cloud. Try recreating the project without using Git, and see if it works.

Related

Cocoa Swift: Launch At Login not working & throws error in Xcode?

I am using https://github.com/sindresorhus/LaunchAtLogin as it reduces the hassle to implement Launch At Login from Scratch.
I did follow all the instructions in the README as follows -
Made a Podfile & installed with pod install
platform :osx, '10.12'
target 'myApp' do
use_frameworks!
pod 'LaunchAtLogin'
end
Added a new "Run Script Phase" below "Embed Frameworks" in "Build Phases" with the following:
./Pods/LaunchAtLogin/LaunchAtLogin/copy-helper.sh
But I get the error
cp: /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/LaunchAtLoginHelper.app: No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
As you can clearly decode from the error LaunchAtLoginHelper.app cannot be found at /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/ that's why the build is failing.
How do I generate that or what should I do to sort this thing out because this makes Launch At Login not work?
I also made a simplest demo for the app to see if it works but it doesn't - https://github.com/deadcoder0904/LaunchAtLoginPod
PS - I have also code signed the application as I did follow this & checked it with codesign -dvv /Applications/myApp.app & it returned Build Time perfectly.
I had the same issue while using Carthage instead of CocoaPods. Currently, there seem to be lots of open CocoaPods' related issues in this project's repository so you might consider trying Carthage and follow these steps.
I solved this issue using the following steps:
In XCode, under Build Settings, under signing, make sure Code Signing Identity is set to either Sign to Run Locally or any other form of actual signing
Use this tutorial to install Carthage
Follow the install and usage of the package, using Carthage, as appears in the README file here: https://github.com/sindresorhus/LaunchAtLogin
Delete all of the contents in DerivedData
To make sure, also clean the project: (Product -> Clean Build Folder)
In your project's folder, execute carthage build
There should now be a new folder inside your project's root folder named Carthage. Inside, there is a Build folder. Search for the file LaunchAtLogin.framework.dSYM (note the .dSYM extension)
In XCode, under Build Phases, in Embed Frameworks step, drag and drop the .dSYM file (see image below)
Change the destination to Products Directory (see image below)
Check the Code Sign On Copy checkbox of this framework (see image below)
Add another step New Run Script Phase, make sure it runs the native shell (/bin/sh). Inside, add this line: exec "${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh" (this is the line that appears in the repository) - (see image below)
Make sure that the script appears after the embedded framework
Build and run
Not exactly an answer but found an alternate solution.
I couldn't solve this with CocoaPods but I did make a simple demo with Carthage & it worked.
Here's the link for the interested - https://github.com/deadcoder0904/LaunchAtLoginCart
Edit:
Found the solution thanks to Ferruccio
Add a new "Run Script" below "[CP] Embed Pods Frameworks" in "Build Phases" with the absolute path to copy-helper.sh.
For simplicity, you can just drag & drop copy-helper.sh. Drag it inside label Shell. Then change Location to Absolute Path
Also you can try https://github.com/deadcoder0904/LaunchAtLoginPod as a simple working demo.

Framework not found GoogleMaps sdk in iOS

I want to use google map to existing(not a new one) iPhone project.Now i am using Google map ios sdk and i successfully added google map framework to my project.But i got error like this
ld: framework not found GoogleMaps
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this issue.I am using xcode4.5 and google map iOS sdk version is 1.5. When i am creating new project with google map iOS sdk then no error getting for me.Error only for existing iOS Project.Please help me.
I solved my issue
You need to do this
Click on your project (targets)
Click on Build Settings
Under Framework search paths (set your framework path)
Following information for getting framework search paths
Right click on your framework folder (for ex: GoogleMaps.framework)
select Get info
copy the path from General->where and paste this path in your framework search path (path should contain in single line)
Good luck
I encountered a scenario in which I had to import a project that was using Google Maps and noticed the same problem - module: "Google Maps" not found.
To solve this problem it was necessary to delete Podfile.lock and Podfile folder and re-install the pods again. Good luck !
You can also :
- remove GoogleMaps from Podfile
- pod install
- add GoogleMaps to your Podfile again
- pod install
This solution works for me, you can also check the search paths a well.
Clean your project. The shortcut is command + shift + k. This will clear information that xcode has stored that might imply that the sdk isn't included.
Also press the project icon at the top of the hierarchy of files, press the target that is your project, press build phases, open link with binary libraries, and make sure that the google maps sdk is in there. If it is not, press + and add it in.
Follow the steps :
Download GoogleMaps-iOS-1.1.0.zip from their site
Unzip the file. You now have a GoogleMaps-iOS-1.1.0 folder
In that folder you have a GoogleMaps.framework folder.
Copy or move the GoogleMaps.framework folder to inside your project folder (in Finder).
Drag the GoogleMaps.framework folder onto your Frameworks group in Xcode.
In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
(Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)
Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.
From : <GoogleMaps/GoogleMaps.h> file not found Google Maps SDK for iOS
my problem was fixed by adding in:
build settings
Framework Search Paths
clickable and add the following lines:
"${PODS_ROOT}/GoogleMaps/Base/Frameworks"
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks"
If you use Pods
Left menu > Pods > Pods > choose Framework > right menu > copy path from "ios/....."
My: ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework
Then Project > Build Setting > Framework Search Path > Click on
$(PROJECT_DIR)/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
Sometimes it happens when you are migrating the code from one system to another so your Framework search paths look empty at this moment, so one simple solution I try is to reinstall the podfile and it works for me.
I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h" and "#include <GoogleMaps/GoogleMaps.h> in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:
In the Podfile:
pod 'Google-Maps-iOS-SDK', '~> 1.9.2'
And in your Bridge file:
#import "GoogleMaps.h"
Delete derived data and delete Podfile.lock file and then run pod install.
Maybe it'll be useful for anybody, next steps helped me:
1. Delete "Headers" and "GoogleMaps" folders manually (from the Finder).
2. Run 'pod install'
3. Re-build the project in Xcode.
In my case, I forgot that I need to open the workspace file with pods, not the project.

lexical or preprocessor issue file not found occurs while archiving?

I am new to this iPhone development and i have almost completed my first application but when i try for creating an archive it gives an error lexical or preprocessed issue file not found But it runs fine in simulator and also has also tested on device. I have included SDwebimage architecture for lazy loading of image in table view.Can any tell me what is the issue?
Few things to try, Ensure the Framework and all it's headers are imported into your project properly.
Also in your Build Settings set YES to Always search user paths, and make sure your User header paths are pointing to the Framework.
Finally, Build->Clean and Restart Xcode.
Hope this helps !
UPDATE: According to SDWebImage's installation, it's required you make a modification to Header Search Path and not User header paths, As seen below.
Have you done this as well? I suggest slowly, re-doing all the installation steps from the beginning.
Spaces in a folder name in your header search path can cause this problem. Make sure the folders in your project do not have spaces in their names.
My project was building fine until I updated to Xcode 10.1. After the Xcode update, started getting Lexical or preprocessor Issue errors on build. Some XCDataModel header files could not be found.
This fixed the issue.
Go to Build Settings, Header Search Paths
Change the appropriate value from $(SRCROOT) non-recursive to recursive.
This ensures that subfolders are also searched for headers during build.
I had this same issue now and found that my sub-projects 'Public Header Folder Path' was set to an incorrect path (when compared with what my main project was using as its 'Header Search Path' and 'User Header Search Path').
e.g.
My main project had the following:
Header Search Paths
Debug "build/Debug-iphoneos/../../Headers"
Release "build/Debug-iphoneos/../../Headers"
And the same for the User Header Search Paths
Whereas my sub-project (dependency) had the following:
Public Header Folder Path
Debug "include/BoxSDK"
Release "include/BoxSDK"
Changing the 'Public Header Folder Path' to "../../Headers/BoxSDK" fixed the problem since the main project was already searching that folder ('../../Headers').
PS: I took some good screenshots, but I am not allowed to post an answer with images until I hit reputation 10 :(
I had this problem after changed project name. I used all the methods mentioned on the internet but still doesn't work. Then I realized that all the header files not found was from cocoapods, so I re-installed the cocoapods using pod install, and thus solved the problem.
Hope this could help.
In my case I was developing a framework and had a test application inside it, what was missing is inside the test application target -> build settings -> Framework Search Paths:
The value needed to be the framework path (the build output - .framework) which is in my case:
"../FrameworkNameFolder/" - the 2 points indicates to go one folder up.
Also, inside the test application target -> Build Phases -> Link Binary With Libraries:
I had to remove the framework file, clean the project, add the framework file again, compile and this also solved the issue.
The new version contain fix for this, feel free to update.
Or you can just replace
#include "iPhone_View.h"
with
#if UNITY_VERSION < 450
#include "iPhone_View.h"
#endif
Delete the unit testing from your project follow the below steps this will solve the issue.
select your project from the project navigator to open the project editor. From the target delete the test from the left side of the project editor and press the Delete key.
I know this is old, but I'm gonna chime in anyway because it may be useful to someone. If you can still see the file in Finder, then click on the file in your project and delete it, selecting "remove references" and not "move to trash".
Once the reference is removed, drag and drop the file from finder into your project again and it should sort itself out.
Just adding another thing that worked for me :
react-native link
Evidently my ReactNative files were no longer there. I could figure that out by clicking on
Build Phases -> Link Binary with Libraries ->
Then right clicking a file I knew was responsible for React, and clicking Show In Finder .
But nothing opened. So assuming the library went missing, I just ran the above command which relinked everything again.
Also if you havn't, try :
rm -rf node_modules/ && npm install
This happened to me after I renamed a file. For some reason it was still looking for the file with the old name. What I did was create the file that it was complaining about and added to the project. Then I did a Project->clean, then Project->Build and verified the error was gone. Then I selected the newly added files and deleted them. This removed all references and I no longer see the error.
I fixed mine. The fb sdk downloaded (from my browser) as 'FacebookSDKs-iOS-4.22.0' -- I just had to rename the folder to FacebookSDK. So now in Build
Settings --> Framework Search Paths
the path looks something like /Users/.../Documents/FacebookSDK (where as before it was /Users/.../Documents/FacebookSDKs-iOS-4.22.0)
Hope this helps!
For what it's worth, my problem was completely unrelated to the error Xcode was giving. I stumbled onto a solution by deleting the .h reference, compiling, adding the reference back and compiling again. The actual error then became evident.

Iphone app archive - No such file or directory

I am almost ready to release my iphone app. I use restkit for consuming my webservice. When I archive, it fails with this error:
cp: /Users/myusername/Library/Developer/Xcode/DerivedData/project-name-/ArchiveIntermediates/project-name/IntermediateBuildFilesPath/UninstalledProducts/include/RestKit: No such file or directory
I dragged & dropped restkit into the project. It builds and works fine in debug mode. I am guessing it is unable to locate restkit dir while archiving. But I am not sure why. Any thoughts?
I've had trouble linking with my own framework in the past, but I have a procedure that works. Even though I don't understand it, it works so I follow it like voodoo, and I don't risk angering the gods by asking too many questions.
Here's what I'd try on your project (again, partly voodoo here):
Navigate to the Frameworks folder in the project nav, select the RestKit and delete it with the delete key. Just delete references.
Using Finder, option-drag (copy) the framework from wherever you first got it
(~/Downloads, or another project or wherever) into your project directory, replacing files if prompted.
Back in your project, select the project, then the target, then build phases.
Open the link binary section, hit "+", then the "Add Other.." button on the bottom of the dialog
Browse to the framework you copied in in step 2.
See if you can clean, build, archive. Easy enough to try, and no livestock are harmed. Hope it works for you.

How to run phone gap with xcode4?

Since moving to XCode4, I have been getting errors like:
/VERSION: No such file or directory
cp: /javascripts/phonegap..js: No such file or directory
cp: /javascripts/phonegap..min.js: No such file or directory
error: /VERSION: No such file or directory
for projects that were working under XCode3.
Open XCodes Preferences, and navigate to Source Trees. If there is no PhoneGapLib entry there, try adding a new setting with the following values:
Setting Name: PHONEGAPLIB
Display Name: Phone Gap Lib
Path: /Users//Documents/PhoneGapLib
Note that the path should be to the location of your PhoneGapLib folder, and that it may not be in your documents folder, depending on how you installed PhoneGap.
I just learned about a great web service recently made available by Nitobi (makes of PG), which will automatically generate the necessary PhoneGap files you need for use in Xcode 4.
Just enter your project name, hit a button and they'll generate a zip file for you to download. This lets you set up a new project without messing with the command line.
You could set up a new project, then migrate your older project files over.
Did you search Google for this error?
I'm a bit of a noob with PhoneGap and Xcode still, but I know there have been recent issues with PG and Xcode 4. Perhaps you're experiencing the same issues as the commenters to this post: PhoneGap + XCode4 (and more specifically, here).