PromiseKit doesn't compile with Swift 2 and Xcode 7 - xcode

This is the error I am seeing when I try to build my project after installing PromiseKit.
Cannot import module being compiled.
This is what my PodFile contains to install PromiseKit.
pod 'PromiseKit', :git => 'https://github.com/mxcl/PromiseKit.git', :branch => 'swift-2.0-minimal-changes'
I tried having the following statement in PodFile, but it was throwing many more compilation errors, so I tried the above statement.
pod "PromiseKit", "~> 2.0"

This is a bug in the minimal-changes branch. The swift-2.0-beta5 branch will work, though it may require more changes in your project. I will fix the bug in minimal-changes.
Edit: Fixed: https://github.com/mxcl/PromiseKit/commit/d969c72b9f959d7fb5a68f117142c79bf0c3098d

Related

Trying to Rebuild a Legacy IOS App, Getting Error in Facebook-IOS-SDK Cocoapod

I've been asked to rebuild an existing IOS app that uses Facebook-IOS-SDK. The app is at least 5 years old so I expected things to be deprecated. I have some limited experience with XCode and IOS but I'm far from an expert. I've never used cocapods until today. I installed cocoapods and ran pod init. Facebook-IOS-SDK ver 3.24.4 loaded with no errors (other pods too, including Bolt, with no errors).
I've read the migration notes on the FB dev page regarding the versions and it's implied that I should be able to use 3.24. When I do a clean build I get the error:
(FBRequest *)requestForUpdateOpenGraphObject(id<FBOpenGraphObject>)object
{
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
}
Expected method to read dictionary element not found on object of type 'id<FBOpenGraphObject>'
This error is in FBRequest.m, the cocoapod code, not in my clients code. This code is marked read only. If this is the correct pod version, and I can't change it then is there some other dependency in the (large) project that needs to be updated?
Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, "9.0"
target "tbd" do
pod 'IQKeyboardManager'
pod 'UICKeyChainStore'
pod 'CocoaLumberjack', '~> 2.0.0-beta'
pod 'SDURLCache'
pod 'HockeySDK'
pod 'Facebook-iOS-SDK', '~> 3.23'
pod 'GoogleAnalytics-iOS-SDK'
pod 'UIActionSheet-Blocks', '~> 1.0'
end
target "tbdTests" do
end
The only, nasty, solution I found is to change the code inside FBRequest.m manually.
Change line 370 from:
return [FBRequest requestForUpdateOpenGraphObjectWithId:object[#"id"] graphObject:object];
to
return [FBRequest requestForUpdateOpenGraphObjectWithId:object.objectID graphObject:object];
this should make you project runs again.
Again, this is not a nice solution, but it works :)
Emilio
if you don't have the need to use Facebook-IOS-SDK ver 3.24.4 you can simply use the latest version 4.36.0.
have a look at your Podfile and see if there is any reference to Facebook-IOS-SDK, if there is something like:
pod 'Facebook-IOS-SDK', '~> 3.0'
you can replace it with:
pod 'Facebook-IOS-SDK', '~> 4.0'
otherwise post your Podfile and we can have a look.
Cheers

SDK image not found when running OSX UI Tests with Cocoapods

I am trying to add my first automated UI tests to my application and am running into quite a bit of difficultly.
The app will build in its current state and the main application itself runs just fine. However, when I try to run my tests I get the following error:
2016-08-02 19:39:33.340 XCTRunner[17590:966857] Running tests...
2016-08-02 19:39:33.407 XCTRunner[17590:966857] The bundle “MYAPPUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2016-08-02 19:39:33.407 XCTRunner[17590:966857] (dlopen_preflight(/Users/username/Library/Developer/Xcode/DerivedData/MYAPP-bdpxtxtxmsobtreqnojvykobjlts/Build/Products/Debug/MYAPPUITests-Runner.app/Contents/PlugIns/MYAPPUITests.xctest/Contents/MacOS/MYAPPUITests): Library not loaded: #rpath/HockeySDK.framework/Versions/A/HockeySDK
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/MYAPP-bdpxtxtxmsobtreqnojvykobjlts/Build/Products/Debug/MYAPPUITests-Runner.app/Contents/PlugIns/MYAPPUITests.xctest/Contents/MacOS/MYAPPUITests
Reason: image not found)
I've seen that there are a few related questions on SO but none of them see to help me out.
Originally, I was implementing my tests in Swift on top of an Objective C application and thought that might be the problem. However, I discovered after making an Objective-C based test target that I am running into exactly the same issue in Objective C.
Thanks for any help.
EDIT
Some additional information: I have tried this using both Cocoapods 0.39.0 as well as the latest non-beta 1.x release. Both resulted in the same error.
My podfile is listed below (for 0.39.0)
platform :osx, '10.9'
link_with 'MYAPP', 'MYAPP MAS', 'MYAPPUITests'
pod 'AFNetworking', '~> 2.5.0'
pod 'ISO8601DateFormatter'
pod 'CDEvents', :git => 'https://github.com/rastersize/CDEvents'
pod 'MASShortcut', '1.3.1'
pod 'libPusher', '1.6'
pod 'NPReachability', :git => 'https://github.com/Abizern/NPReachability.git', :commit => 'e57753d'
pod 'CocoaLumberjack'
pod 'SocketRocket', :git => 'https://github.com/marianoabdala/SocketRocket.git'
pod 'HockeySDK-Mac'
pod 'INAppStoreWindow', '~> 1.4'
I was able to fix this after spending 2-3 days on this by adding an obscure step to my Build Phases.
I created a Copy Files build step after the Link Binary With Libraries step and before the Embed Pods Frameworks step.
I copied the offending framework ("HockeySDK") into the Products Directory. This solved the issue!
Ultimately this may be related to my app being a StatusBar App, not a regular app, as the solution which finally worked for me was related to a CommandLine application running into the same bug.
Link to Github bug page with the solution that worked for me

Migrating to CocoaPods 1.0.1

I am trying to migrate our existing CocoaPod configuration from 0.39.0 to 1.0.1.
Our existing Podfile looks like:
platform :ios, '9.0'
use_frameworks!
target 'Tools' do
pod 'zipzap', '~> 8.0.4'
pod 'Argo', '~> 2.2.0'
pod 'Curry', :git => 'https://github.com/thoughtbot/Curry.git', :commit => 'eeb459fac309833288e61e134a4e8fad649e99b0'
end
target 'ToolsTests' do
end
This compiled and the tests ran just fine previously. After following the migration guide. I restructured the Podfile like so:
platform :ios, '9.0'
target 'Tools' do
use_frameworks!
pod 'zipzap', '~> 8.0.4'
pod 'Argo', '~> 2.2.0'
pod 'Curry', :git => 'https://github.com/thoughtbot/Curry.git', :commit => 'eeb459fac309833288e61e134a4e8fad649e99b0'
target 'ToolsTests' do
inherit! :search_paths
end
end
This compiles and links just fine. Unfortunately when the tests run they crash with:
2016-06-07 12:04:06.265 xctest[56474:789900] The bundle “ToolsTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2016-06-07 12:04:06.299 xctest[56474:789900] (dlopen_preflight($HOME/Library/Developer/Xcode/DerivedData/Tools-dbmncsubtoarlhhcrpchrswefprz/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ToolsTests.xctest/ToolsTests): Library not loaded: #rpath/Argo.framework/Argo
Referenced from: $HOME/Library/Developer/Xcode/DerivedData/Tools-dbmncsubtoarlhhcrpchrswefprz/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ToolsTests.xctest/ToolsTests
Reason: image not found)
Program ended with exit code: 82
In the migration guide it says:
A large fraction of the bug reports we receive is due to ambiguity in the Podfile. It gave a lot of freedom to create all kinds of CocoaPods setups that would work by luck of implementation details, or work but are significantly more complex than they needed to be.
Is this one of those cases that used to "work by luck of implementation details"? If not what is the correct Podfile syntax?
I should note if I duplicate the pod defs in the ToolsTests everything works just fine. Though this feels wrong.
Similar question: Cocoapods testing linker error
Seems to be a common problem people are facing when upgrading. Your new Podfile looks right to me.
If you haven't already, I would try:
cleaning the build folder (in Xcode -> Option+Shift+Command+K)
clearing the derived data folder (rm -rf ~/Library/Developer/Xcode/DerivedData)
clearing your CocoaPods cache (rm -rf ~/Library/Caches/CocoaPods)
and run pod install again
EDIT:
The question I mentioned above has an answer now: https://stackoverflow.com/a/37705768/3067051

GCDWebServer fails to comile when CocoaLumberjak is included in project

When using cocoapods, with those 2 libs:
pod "GCDWebServer", "3.3.2"
pod 'CocoaLumberjack', '2.2.0'
Project fails to compile, as GCDW does not link to LumberJack (even optionally).
Adding Lumberjack to "Linked Grameworks and Libraries" as optional, for GCDWS pod fixes the issue, but it is only a workaround, as each
pod install resets the state, making it pain in the a$$ to work with, and impossible to have it build by CI env.
Any ideas of how to solve that?
BTW - GCDWebServer guys, why you have dissabled issues on GitHUb!?
This was fixed by https://github.com/swisspol/GCDWebServer/pull/256. Use this in your podspec:
pod 'GCDWebServer/CocoaLumberjack'

Xcode 7 - Cocoapod not importing

i am using Xcode 7 Beta3.
I tried to include one dependency, so this is my podfile:
platform :ios, '8.0'
use_frameworks!
target 'Test' do
pod 'Alamofire', '1.2.3'
end
target 'TestTests' do
end
target 'TestUITests' do
end
But when i import this class:
import Alamofire
i get:
No such module Alamofire
Anybody had this issue before?
Thanks and Greetings!
I ran into issues where Xcode 7 Beta 5 (7.1)(newest at the time) mixed with a Podfile would not recognize any of the pods I wanted to import.
Cocoapods updated to fix these issues.
[sudo] gem update cocoapods
Once that was up to date, I checked the git repositories that were included in my Podfile to see if any of them had Swift 2 branches.
After adding the :branch => 'swift-2' to the Podfile for the pod I am using, I was able to make the error in Xcode go away, and import the module.
Based on the comments on your question, Alamofire does have this branch and you should use that.
Run pod update on your project after saving your Podfile.

Resources