Pod install GPUImage does not work - swift

I am working on a Swift project with cocoapods. Here is Podfile:
pod 'GPUImage', '~> 0.1.4'
After i run pod install, i try got the error about import file:
import GPUImage
I uninstalled GPUImage from podfile, then try the second solution, i got different error.
This link is the project instruction on github. My steps are:
Copy&Paste GPUImage.xcodeproj into project root directory, and added it into my project.
Go to "Build settings" -> "Build Phases" -> "Target Dependencies", added PUImageFramework, in Link Binary With Libraries section, added GPUImage.framework.
But i got an error:
error: unable to read module map contents from 'Source/iOS/Framework/module.modulemap': Error Domain=NSCocoaErrorDomain Code=260 "The file “module.modulemap” couldn’t be opened because there is no such file." UserInfo=0x7f872cfb0b80 {NSFilePath=/Users/william/A/muguang-ios/Source/iOS/Framework/module.modulemap, NSUnderlyingError=0x7f87413f4dd0 "The operation couldn’t be completed. No such file or directory"}
Any help, thx!
EDIT:
The error right now is:
dyld: Library not loaded: #rpath/GPUImage.framework/GPUImage
Referenced from: /private/var/mobile/Containers/Bundle/Application/9CF1D10C-1D78-40CB-955F-19110B3C3EA8/testGDU.app/testGDU
Reason: image not found
EDIT:
For solution without using pods, here is solution:
You then need to add a new Copy Files build phase, set the Destination
to Frameworks, and add the GPUImage.framework build product to that.
This will allow the framework to be bundled with your application
(otherwise, you'll see cryptic "dyld: Library not loaded:
#rpath/GPUImage.framework/GPUImage" errors on execution).
But question 1 with cocoapods still not work.

it's my bad, i got the solution:
You then need to add a new Copy Files build phase, set the Destination
to Frameworks, and add the GPUImage.framework build product to that.
This will allow the framework to be bundled with your application
(otherwise, you'll see cryptic "dyld: Library not loaded:
#rpath/GPUImage.framework/GPUImage" errors on execution).

I had the same issue with the following library versions:
Xcode 6.3
Cocoapods 0.37.2
Finally I solved this issue by the following steps:
First step:
Open Xcode
Click Window (Menu Bar)
Click Projects
Remove all projects (e.g. use backspace)
Close Xcode
Second Step:
Open a terminal app
cd ~/Library/Developer/Xcode/DerivedData
rm -rf Build/* see below if you have a customized build location
rm -rf ModuleCache/*
Close a terminal app
Third Step:
Open Xcode
Product > Clean
Product > Run
If you have defined a custom build location:
Go with Finder or the Terminal to the location of the build files. The location for these files is defined in Xcode. To check where these files are:
Open Xcode
Go to Settings -> Locations -> Derived Data
Go to that location and delete the Build folder
Then everything work well.
Hope this can help somebody in the future.

In my case, just change Develop account in Signing & Capabilities then build app again. 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.

Xcode GIT problems iPhone App

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.

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.

Facebook iOS SDK sample code doesn't compile

I downloaded the code from https://github.com/facebook/facebook-ios-sdk
But none of the sample projects compile in Xcode. I have read the readme.txt and it doesn't help.
The error is: 'FacebookSDK/FacebookSDK.h' file not found
There is no folder called FacebookSDK, it's actually called src. When I change the code to say src the new error is: ld: framework not found FacebookSDK
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone download the code and get the samples to work?
I wrestled with this same problem for a while before discovering that there is a not-so-obvious file that is supposed to be downloaded and installed (versus just getting the ZIP file and its contents). The file is called FacebookSDK-3.0.pkg and I found it at:
http://www.google.com/url?sa=t&rct=j&q=facebooksdk-3.0.pkg&source=web&cd=1&ved=0CEgQFjAA&url=https%3A%2F%2Fgithub.com%2Fdownloads%2Ffacebook%2Ffacebook-ios-sdk%2FFacebookSDK-3.0.pkg&ei=Mg8kULzOLofgiALg14DwDQ&usg=AFQjCNF0i0Vkq_cPsOvfrs5nb_IOUR6XhA&sig2=kERJcdvR7UgAB6mr-RUi6w
(first link provided when searching for the filename)
I installed it and the samples work fine now.
Facebook SDK 3.0 for iOS with samples
For more details https://developers.facebook.com/ios/
If you install the package to another location besides ~/Documents, you need to change the Framework Search Path for the sample projects.
When you open the project up in XCode, click the project info (e.g. blue "HelloFacebookSample" in the file browser.
Go to the Build Settings tab.
Under the "Search Paths" section, find "Framework Search Paths".
Doubleclick the value and you'll see an entry that is like:
$(SRCROOT/../../../../Documents/FacebookSDK
Double click that value and change it to point to the destination folder where you placed the SDK.
In my case, I installed the SDK to /Dropbox/SDKs/FacebookSDK so I changed the value to
$(SRCROOT/../../../../SDKs/FacebookSDK
(the 4 ../ are because it's relative to the HelloFacebookSample project)

Xcode 4.2: Build for Archive is good, but Archive fails with errors

I am trying to build my app and submit it to the App Store but Xcode keeps giving me errors when trying to do that.
When I build and run in the simulator it works, when I build and run for a device it works, when I try to use the build for archive option it works, when I actually try to archive it it will fail with 9 or 11 errors depending on (IMHO) what time of day it is.
Anyone have any idea why? I tried following some other tips such as deleting the project folder in ~/Library/Developer/Xcode/DerivedData
And another user said to clean the build folder but that option is grayed out in the menu bar.
Anyone know of any other solutions?
All my errors are file not found errors, I am using Three20 so the errors are:
'Three20Core/TTCorePreprocessorMacros.h' file not found
'Three20Core/TTDebug.h' file not found
'Three20Core/TTCorePreprocessorMacros.h' file not found
'Three20Core/TTGlobalCore.h' file not found
../scripts/Protect.command: line 23: cd: /Users/[username]/Library/Developer/Xcode/DerivedData/TTCatalog-gcnbfpwscygfrmdhcfiahsatpdba/ArchiveIntermediates/pr/BuildProductsPath/Release-iphoneos/../three20/Three20Network: No such file or directory
'Three20UICommon/private/UIViewControllerGarbageCollection.h' file not found
'Three20Core/TTGlobalCoreLocale.h' file not found
'Three20UICommon/private/UIViewControllerGarbageCollection.h' file not found
../scripts/Protect.command: line 23: cd: /Users/[username]/Library/Developer/Xcode/DerivedData/TTCatalog-gcnbfpwscygfrmdhcfiahsatpdba/ArchiveIntermediates/pr/BuildProductsPath/Release-iphoneos/../three20/Three20UICommon: No such file or directory
The error seems to be path issue in environment variables.
Just carefully follow the steps mentioned in integrating Three20 library # https://github.com/facebook/three20
( use The Second option to add it to your project manually)
Make sure the configuration added to All Configuration (Debug, Release, Distribution(if exists).
Also Make sure your Xcode preference are as below
xcode->preferences->locations
Select Derived Data->relative
Select Advanced -> Legacy