Class is implemented in both when running IOS simulator - ios

I'm using cocoapods version 1.9.1 and Xcode 11.3.1
I'm following this tutorial https://docs.snapchat.com/docs/tutorials/login-kit/ios/
I keep getting this error that says class is implemented in both when running my app on IOS simulator, the problem lies in CoreSimulator/Devices
Class SCSDKCertificateTrust is implemented in both
/Users/Developer/CoreSimulator/Devices/EB370499-8654-42DD-9FC0-
F7ACB17C0532/data/Containers/Bundle/Application/695ED9C1-3329-457C-BCED-
3670C52E4E19/Test.app/Frameworks/SCSDKLoginKit.framework/SCSDKLoginKit (0x1033dba50) and
/Users/Developer/CoreSimulator/Devices/EB370499-8654-42DD-9FC0-
F7ACB17C0532/data/Containers/Bundle/Application/695ED9C1-3329-457C-BCED-
3670C52E4E19/Test.app/Frameworks/SCSDKCoreKit.framework/SCSDKCoreKit (0x10339b098). One of
the two will be used. Which one is undefined.
My Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Test' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Test
pod 'SnapSDK'
end
I'm not sure how to fix this problem and I have searched the net and found multiple solutions especially on SO
Class is implemented in both. One of the two will be used
Class is implemented in both, One of the two will be used. Which one is undefined
Unfortunately most of the solutions are about fixing it on .xcconfig file and remove in OTHER_LDFLAGS.
I tried those two solutions and it didn't work, could it be because of the cocoapods version?
because I tried this on my Xcode 10 version and still produced the same problem

For me:
Go to your Project in the top of the file navigator in Xcode and click Package Dependencies. Remove any dependencies that you may have installed using 'Add Package' instead of with cocoapods, or that may be causing the error.

Related

Importing AudioKit framework gives "'x' is not a member type of 'AudioKit' errors

I've been trying to add AudioKit to a project in Xcode to no avail - even blank projects created just to import AudioKit into my View Controller are throwing 2711 errors, mostly saying "'x' is not a member type of 'AudioKit', "Initializer does not override a designated initializer from its superclass", and "Method does not override any method from its superclass".
I'm trying to add AudioKit by directly adding the frameworks to the project as recommended by this video https://www.youtube.com/watch?v=iUvWxWvRvo8&feature=youtu.be, adding appropriate Framework Search Paths and Linker Flags to the build target.
I've read that these errors can be thrown by types and frameworks having the same name, and AudioKit contains a header file called "AudioKit.h". Changing the name of this throughout AudioKit didn't help, however, and the import AudioKit line started giving me a 'No Such Module (changed name)' error rather than the usual 'Failed to load AudioKit'. Changing the name of the framework as a whole had the same effect.
Is this an issue I can solve or something specific to AudioKit? I'm running Catalina 10.15.3. and have been able to install other frameworks via CocoaPods, but that didn't work for AudioKit. It's like pulling teeth here, I'd be grateful for input from anyone with the same issue.
These are the errors I'm being shown:
EDIT: Airdropping my project file onto a different Mac and compiling worked absolutely fine with Audiokit, so I've got no idea what the issue is.
Hi #Jowan and future readers, I had the same issue and found that it's best to stick with cocoapods, here's a working version for the latest ios and swift 5.2:
platform :ios, '11.0'
target 'AKRecorder' do
use_frameworks!
pod 'AudioKit', '~> 4.9.5'
end
I've reported the issue here if you want to take a look in other steps I took (How to include Audiokit 4 in a new project xcode 11 and swift 5.1?)
Good luck!
This issue also happened to me a week ago (my post: AudioKit Playground Builds fail) and the reason why it was brining up these errors, was because I didn't have the newest version of Xcode and AudioKit 4.9.5 only seems to work with the newest version of Xcode. To fix this error, you either need to update your Xcode, or download older version of AudioKit (what I did). To download the older version of AudioKit you can go to this website https://github.com/audiokit/AudioKit/releases and open the older AudioKit version assets, or you can to download it through cocoapods, you will need to write (pod 'AudioKit', '4.9.4') or a different version, in the pod file.

How to include Audiokit 4 in a new project xcode 11 and swift 5.1?

I've recently tried to include Audiokit 4 in a new project using Xcode 11 and swift 5.1, but I get the error message No such module Audiokit, the closest I get to Audiokit is CoreAudiokit by following the instructions in (https://github.com/audiokit/AudioKit/blob/master/Frameworks/README.md).
Here're the steps I followed:
1) Create new single view project in xcode11
2) Project settings, General tab, Frameworks/Libraries added item Audiokit.framework
3) In the ContentView.swift file: import Audiokit or import AudioKit
I've doubled checked the release notes and it clearly states support for Xcode 11 (https://github.com/audiokit/AudioKit/releases)
Finally, tried to compile it myself but the same issue as stated above, module not found.
git clone https://github.com/audiokit/AudioKit.git
./build_frameworks.sh
I can see the AudioKit framework under frameworks:
Other linker flags is also set as instructed:
Updated to Xcode 11.4 (latest), same issue.
Also tested moving the audiokit dir, same issue, nothing seems to make it work, so not sure what other people been doing considering the comments in github which seems they use it with Xcode 11.4...
Try changing the "Embed & Sign" setting for the frameworks to "Do Not Embed". The built frameworks are static and while they need to be linked in your project, they should not be embedded since they can't be dynamically loaded.
After hours trying things, I found a solution!
Just have in mind before proceeding that I've updated to the latest (time of writing) Xcode 11.4 and swift 5.2.
I've moved the file from Frameworks / AudioKit.framework to the project:
And then, while selecting the AudioKit.framework in the show/hide inspector, I change the location to relative to project and target to the current project name as follows (the name of the project changed to test in comparison with the earlier or original post version):
Obs: I've also tested by modifying the build settings, removed all subdirectories to exclude in recursive searches extensions; and add the relative path where the audiokit.framework can be found to the framework search paths. The autocomplete works, but I still get the error No such module 'AudioKit'. So, this far the only option that works is the comment before.
--------------------- a few days later ------------------------
Just had a quick look at this and decided to update the report here.
Unfortunately, the fix above removes the "not found" error but the application crashes. Using cocoapods to install audiokit also seems to not cause the "module not found error".
-------------------- weeks later --------------------
Use cocoapods to include audio into your project as last stated and as follow:
platform :ios, '11.0'
target 'AKRecorder' do
use_frameworks!
pod 'AudioKit', '~> 4.9.5'
end

All Pods not recognized after starting the process of adding to app store 'No such module' error

My app worked just fine until I started the process to upload to the app store and somewhere during that process, I started getting the error 'No such module'.
I have tried different pods, same result
I have tried a new blank project with just the import line (after importing the pod), same result
After eliminating the pod it self and the project, it has got to be a setting that got changed that won't allow it to see the pod files. If anybody has any thoughts, I would be greatly appreciative.
*edit: Taking Dershowitz123's advice, I have tried changing the path for the frameworks to
$(SRCROOT)
screenshot1 (sry, I don't have the reputation to post embedded images yet).
I still get a failed build, but I think you are in the right direction. I noticed that it isn't finding the framework file.
screenshot2
I've looked for the file listed and I don't see one in the directory anywhere. When I made my blank test project, it also didn't create a Pods_RiskAssement.framework file (or similar named file).
*edit 2
here's my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target ‘RiskAssement’ do
pod ‘SimplePDF’
end
*edit
Resolution. I was unable to figure out how to import the pod, but was able to copy the swift file data and embed it directly into the code for my app. This way I didn't need to reference the pod and was able to build the app.
I'm not sure why this is actually happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which 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.
I recently received the same 'No such module' message for the different PODS that I had installed. The resolution for me was to select the PODS project in my workspace, select all of my targets, and then manually build them using either the menu command or the Command B shortcut. After it finished building the errors went away.
I hope it helps!

Xcode 7.3 Syntax Highlighting and Code Completion issues with Swift

I am having an extremely frustrating issue with XCode 7.3 (however, this issue has persisted since I installed XCode 7.2) and Swift code, and I am hoping others have had this issue and know how to resolve it. Syntax highlighting and code completion work perfectly fine in Objective-C files, and also works fine when calling other Swift objects within Swift code. However, any Objective-C objects or methods mentioned in Swift code get no syntax highlighting, and XCode will not complete ANY Objective-C declared methods or properties. Everything compiles and runs just fine.
I should also add that I have also tried doing a completely clean install of XCode. I deleted all my derived data, deleted all XCode caches, and deleted my XCode preferences files (in addition to obviously deleting the XCode.app archive before re-installing).
It is making it extremely difficult to develop in Swift. I don't want to do this, but if I can't find a way to resolve this I'll be forced to go back to using Objective-C.
I have the same problem. But finally solved it.
I make two change, not sure which is the key point but you can try them all.
delete the module cache
Within the same folder as your project's Derived Data is a Module
Cache. When Code Completion stopped working, deleting this fixed it.
Close Xcode and delete the
~/Library/Developer/Xcode/DerivedData/ModuleCache directory.
change the Enable Modules value
Go to the Build Settings of your target, then search Enable
Modules
If it's Yes, change it to No, and you may get some build
error, just change it back to Yes.
After two steps above you should Clean(Shift+Command+K) your project.
For now you may fixed the problem.
So it seems the issue was with CocoaPods. I was using Cocoapods as a static library instead of as frameworks. Switching to frameworks (using use_frameworks! in my Podfile) and importing the libraries into Swift has resolved all my issues. I'm guessing all those third party library headers were just too much for XCode to process. Either way, the issue is now resolved. I hope this helps someone in the future.
This might not be necessary anymore but i still want to post this:
At the time of this post, the most recent version of cocoapods (1.0.0.beta.8) requires you to define pods for each Xcode target.
In my case I had a class compile for the project target and for a testing target. I added a pod only to the main target, because of laziness.
Now working in the code of class A I added the pod framework using import NAME and tried to use the classes of the framework. Xcode wouldn't highlight the particular code where I use the new classes, but compiling and running works fine. In the completion dialog the type of the variable was <<error type>>
The way to resolve this issue: in the Podfile add the newly added pod to all targets, the class A is member of.
Now Xcode finds the necessary frameworks for all targets and code highlighting works again.
EDIT 1:
A possible solution is defining a list of shared pods, like in my example:
platform :ios, '8.4'
use_frameworks!
inhibit_all_warnings!
def all_pods
pod 'MPMessagePack'
pod 'SwiftyDispatch'
pod 'BFKit'
pod 'Timepiece'
pod 'Alamofire'
pod 'AlamofireSwiftyJSON'
end
def testing_pods
pod 'Quick'
pod 'Nimble'
end
target 'App' do
all_pods
end
target 'AppLogicTests' do
all_pods
testing_pods
end
target 'AppUITests' do
pod 'RxTest'
all_pods
testing_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
puts target.name
end
end
This will add all pods to all targets and adding all testing pods to the targets. Next to these I added 'RxTest' to the AppUITests.
(Chosen pods are examples of my projects, no advertising intended :-) )
We had the same issue in a mixed ObjC/Swift project. Tried all the suggestions about deleting derived data etc, to no avail. Sometimes it helped, but not in a reproducible way and after some time it stopped working.
The post of Galvin in this post put me on the track of the Module related build settings. However it was another setting that solved the code completion/coloring in a reproducible way: setting DEFINES_MODULE (under Packaging) from YES to NO for our main project was the solution.
Notes:
I expected this to break the ObjC/Swift interoperability in our project, but that still works. It seems that setting is only to be used for framework targets. (https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)
This project setting has not been changed for months, but the code completion issues came up only recently, both for my colleague and me.
If none of the above worked for you and you're using Cocoapods, you can try switching to Carthage.
I tried every suggestion I could find on Google to no avail. But consistently Cocoapods seemed to be coming up as a reason with many hacks in attempt to fix it. I have been reading up on Carthage, and how it doesn't modify your project, force you to use a workspace, or potentially fill your build folder with header files (which confuses Xcode and can cause the syntax highlighting and autocomplete to break).
After making the switch I haven't run into any issues yet, and to be honest I prefer the teensy bit of overhead to have a clean solution. This post really drove it home for me.

Live Rendering a custom component using IB_DESIGNABLE from a pod dependency

I'm having some difficulty using IB_DESIGNABLE in a pod.
I created a custom view which I marked as IB_DESIGNABLE and made a sample project that uses it. No problems so far.
The issue happens when adding that custom view as a pod dependency. Although the project builds and runs successfully, there is an error when the storyboard that uses the custom view is opened. The Live Rendering process starts and tries to show the view live inside Interface builder but it fails with the following error:
This is too bad because we lose Live Rendering which is, in my opinion, one of the best features from Xcode 6.
Cocoapods gem version: 0.34.4
Xcode version: 6.1 (6A1052d)
I've tried with other projects that use IB_DESIGNABLE and have a podspec:
https://github.com/Eddpt/EAColourfulProgressView (Class: EAColourfulProgressView)
https://github.com/hayashi311/HRButton (Class: HRButton)
https://github.com/Estimote/iOS-Indoor-SDK (Class: ESTIndoorLocationView)
Someone else had the same issue in Estimote - Indoor Location Error but the solution described means losing Live Rendering capabilities.
Has anyone been able to use a IB_DESIGNABLE component through Cocoapods?
Error: "failed to load designables from path (null)"
This has been fixed in the latest version of Cocoapods (0.36.0.beta.1).
To install this version:
[sudo] gem install cocoapods --pre
More information about Cocoapods with frameworks here
In order to fix the Error: "failed to load designables from path (null)":
platform :ios, '7.0'
use_frameworks!
target 'test' do
pod 'EAColourfulProgressView', '~> 0.1.0'
end
target 'testTests' do
end
Add use_frameworks! to you Podfile.
When specifying your custom class in the Identity Inspector, are you specifying from which module this class should be loaded? The module should be the name of the library the class comes from.
I Resolved my problem using use_frameworks! on the PodFile, in the first Line. (don't forget the !)
IBInspectable properties must be Dynamic, so it asks for a Dynamic Linkage of the Library. By using the above line, as soon as you set the class of a control, it will build the framework and link it, resolving this binding issues. When I upgraded to beta, Parse stopped working.
Hope it helps someone.

Resources