So I received a project from a client to perform a code review on. I can't get it to work though.
I am getting an error on an extension class for Alamofire, which is included using CocoaPods. The class contains an import Alamofire statement, so it is included. Cmd clicking the name of the class navigates to the Alamofire pod and the relevant class (DataRequest), so that works.
I have tried building the pods by themselves, to ensure they are built. I have also tried removing my DerivedData folder, but now I come up short with ideas.
How can I fix this?
Edit: It seems I get other errors about classes not being found, from other Pods and other simple references (not extensions), it looks like my pods are not being integrated in the compile process.
Edit 2: Think I found it:
Target 'Pods-Project' of project 'Pods' was rejected as an implicit dependency for 'Pods_Project.framework' because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'
I have removed the Pods folder, deleted the Podfile.lock file, cleared DerivedData and set the build settings of the pod project to build all archs, not only the selected ones, now it works!
Related
So suddenly my project stopped working and I have no idea why and I'm running out of ideas.
I've found some blogs 1 2 and similar requests 1 2 3 for help but nothing seems to work for me. I may be doing something wrong though.
running xcode 13.4.1
I've got 4 distinct errors
Command EmitSwiftModule failed with a nonzero exit code
error: accessing build database "/Users/myuser/Library/Developer/Xcode/DerivedData/App-btdfdbatbdurmeawknwdwmjrqpsw/Build/Intermediates.noindex/XCBuildData/build.db": disk I/O error
Virtual filesystem overlay file '/Users/myuser/Library/Developer/Xcode/DerivedData/App-btdfdbatbdurmeawknwdwmjrqpsw/Build/Intermediates.noindex/App.build/Debug-iphoneos/App DEV.build/all-product-headers.yaml' not found
/Users/myuser/myapp-ios-app/App/UI/Feed/FeedVC/FeedVC.swift:11:8: No such module 'SDWebImage'
I believe the EmitSwiftModule is related with not being able to handle the pod therefore causing the issue in the "all-product-headers.yaml" which is generated to fetch all the pods headers?
So assuming that all things in derived date are as they should be (because i've deleted it) I tried to focus on why is the pod no longer compiling. To my co-worker is working fine. Maybe he will have the same issue if he deletes the derivedData? Maybe we are using some older version files?
Some things I've tried:
clean the project
reset pods cache
delete derived data folder
update the pods
clean xcode preferences
for this pod they say we should add :modular_headers => true in pod file
re download the project clean to another folder
instead of cocoapods use the package manager for SDWebImage
due "all-product-headers.yaml" issue i read here that i could just add a header to my project
I've tried to create a project from scratch and just use the same pods and the project seems to run fine. But this is not a solution.
Can someone please help me? Any ideas?
New to Xcode (dabble a little). I paid a developer to build an iOS app for me. He sent me the source code and I have opened it in Xcode 13.2.1. I needed to edit the info.plist to include a description why location was required (got this done). When I try to run the build, I get the error 'no such module 'IQKeyboardManagerSwift'. In AppDelegate, I see 'import IQKeyboardManagerSwift --- No such module 'IQKeyboardManagerSwift'. I went to the Podfile directory and ran 'pod install'. Output says:
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 7 dependencies from the Podfile and 8 total pods installed.
I'm still getting the error when trying to run the build. I tried cleaning the build folder and running the build again but still, same error. What am I missing?
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and define the Framework Search Paths to a folder that contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Is the codebase completely in Swift?, else you will have to include import in the Bridging header file
If in swift you can try:
Select project name -> Select Build Settings(tab) and search Framework Search Paths double click and set the desired path($(SRCROOT)) to recursive
The missing module handles a number of keyboard behaviors so you don't have to reinvent that wheel. Check out the developer's website and get it for yourself. I've been using it for years. The developer has helped me more than once get past some obstacles.
I’m developing a framework where I need to use firebase internally.
I added firebase framework manually to my framework as cocoapods didn’t work.
Now, I’m able to build my framework and use it on my local system as expected. But it creates problem when I ship it to other devs and it fails with following errors.
I tried several ways like adding firebase.h in framework's header file. But none of the approaches are working.
Also, apart from this approach, I tried manually adding firebase to main app, where it gave the logs saying duplicate frameworks found.
What am I doing wrong in adding firebase to framework ?
I've already checked some of the related question such as This and this
I suspect, that after transferring the code into the other machine, owner does not runs
pod install
terminal command, so physically the framework does not exist.
I can confirm Aaron answer: be sure to specify a complete, correct path.
I usually avoid as the "evil" cocoaPods (getting worse and worse to use..)
so I downloaded the zip and added all the folder.
I specify ONLY "Framework search path" and "Header search path".
Library search path is empty.
note: as suggested by documentation, I added FireBase.h AND module.modulemap, TOO. (and set -objC flag, too)
Adding one or more search paths for the framework and header file will resolve the issue.
First de integrate pod after try with fresh.
pod 'Firebase'
pod 'Firebase/Storage'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
CocoaPods 1.5.0 static library feature does not work with FirebaseAnalytics because of the non-modular headers in FirebaseAnalytics.h.
Reported at CocoaPods/CocoaPods#7542.
Workaround is a similar post_install step similar to this.
Because the fix is a breaking change, it is targeted for the next Firebase major release.
I'm trying to create a swift program that uses sockets. In order to do that, I'm trying to use the SwiftSocket library by installing it using CocoaPods.
My Podfile is basic:
target 'socket' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for socket
pod 'SwiftSocket'
end
According to the installation guide of SwiftSocket, after installing the pod I should be able to use the TCPClient right away.
Still, I fail to use the class in my main.swift file as it doesn't find the class.
I've searched the web to see what I'm missing here, but all I found are guides on how to bridge Pods written in ObjectiveC but not on pods written in Swift.
Any help?
Thanks
EDIT: With jamshes reginahit suggestion, I've added SwiftSocket.framework to the Linked Frameworks and Libraries, in addition to the Pods_socket framework that was already present.
Now the build is successful, but I gut a runtime error of Thread1: signal SIGABRT with the payload:
yld: Library not loaded: #rpath/SwiftSocket.framework/Versions/A/SwiftSocket
Referenced from: /Users/jonathan/Library/Developer/Xcode/DerivedData/socket-buglawjxihebcabvcihcbdrtkcxt/Build/Products/Debug/socket
Reason: image not found
(lldb)
EDIT2: Something was funky with my Xcode. I've reinstalled it and now it seems to work fine. Thanks to everybody for the help. :)
I would like to comment, but I don't have enough reputation.
Anyway did you write something like:
import SwiftSocket
in the class where you need it? Also, did you open the project with the xcworkspace extension?
If nothing works try to clean and rebuild the project
Based on my checking of the SwiftSocket Library, it seems that what you did should be fine (it should be pod 'SwiftSocket' referring to "Installation" section), I assume that you missed to add :
import SwiftSocket
in your main.swift class.
And yes, they are not mentioning that in "Code examples" section because they -probably- assume that importing it in your .swift file should be obvious.
Once CocoaPods is finished installing, you need to start using the .xcworkspace instead of your .xcproject file. So close your project, open the workspace (same directory), and import SwiftSocket.
Your Podfile seems correct, after that, you need to launch a terminal from your project directory:
cd ~/Desktop/MyProject/
Then run: pod install command.
This will create a .xcworkspace file and a Pods directory.
Now you have to open the .xcworkspace file with Xcode.
Donc forget to import yout pod like this: import SwiftSocket
Also take a look at the CocoaPods documentation: https://guides.cocoapods.org/using/using-cocoapods.html
I am sharing the realm between containing app and extension (custom Keyboard), and it works ok on simulator, but when I'm trying to run this app on the real device I have the following error:
Cannot load underlying module for 'RealmSwift'
It's kinda strange that it is not an issue with simulator but ok. Let's add pods.framework to Link Binary With Libraries for my extension.
.../Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h:19:1:
Duplicate interface definition for class
'BFCancellationTokenRegistration'
OK. Let's remove it.
Cannot load underlying module for 'RealmSwift'
Can't argue that. Let's try to add RealmSwift.framework to the extension.
.../Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h:19:1:
Duplicate interface definition for class
'BFCancellationTokenRegistration'
OK. After several iterations there are several Pods.framework in my project folder and RealmSwift.framework too. Let's remove them all except one Pods.framework. Let's change target membership for this framework to the app and the extension.
.../Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h:19:1:
Duplicate interface definition for class
'BFCancellationTokenRegistration'
and
Cannot load underlying module for 'RealmSwift'
together.
How could this be fixed?
Update: I am using Realm and Parse cocoapods.
It should just be a matter of creating a second section in your Podfile to let you specify the dependencies for your app extension as well as your main app.
target 'MyApp' do
pod 'RealmSwift'
end
target 'MyAppExtension' do
pod 'RealmSwift'
end
CocoaPods does a lot of extra steps in setting up the dependencies and installing them into your target at compile time, so I don't think simply copying Pods.framework to the extensions build steps will work.
If you've got multiple references to the same files floating around, then it may be a good idea to completely delete every CocoaPods-related file/folder from your project, and running pod install again to make sure it's all set up again properly.
Let me know how you go!