Error importing framework in Playground - xcode

I’m following the instructions for Importing Custom Frameworks into Playground, but I still keep getting "No such module” error.
I have tried adding everything in the workspace; a project with just Framework target, project of Cocoa Application with the framework, and just the Framework. I also tried creating a playground in the Application where I imported the framework, I can even import it in other swift file without any problem; but I can’t seem to be able to import it in playground.
Can someone please tell me what I might be doing wrong?

Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!

Did you ever get it to work? I figured out my issue. The code I was trying to import wasn't in a Framework Target. I had to add a new target to my project of type Cocoa Framework. Then include my source files in that framework, and then finally build that target. Then it worked.

I would like to echo what Reid said:
Try building your framework target using a simulator! I had only built mine using the generic device which doesn't work for playgrounds!
If you've updated to Xcode 12, you also need to make the "Build Active Scheme" box is checked. Select your playground and go to the inspector. The checkbox will be under "Playground Settings"

I've spent for this more than 4 hours. But i've solved it for XCode 10.
You're unable to add any framework into the Playground if there's no target for it the Workspace where the Playground is. So as you using downloaded framework (so am i) — you're doomed to fail with it.
The workable manual could be found here (God bless this guy): https://www.pardel.dev/blog/3rd-party-frameworks-in-xcode-playgrounds
tldr: the easiest way is to:
Download 3rd party framework sources.
Open *.xcodeproj
Add Playground to the Project.
Build project for any iOS simulator by cmd+b (have no idea how to use any macOS frameworks yet).
And it should work (at least it does for me).

I solved my problem with a different solution than Michael Welch's. I had my Xcode derived data setting different than original. Go to Preferences > Locations > Derived Data > Advanced and select Unique. This solved the framework not appearing in playground problem for me.

Related

XCode doesn't archive unity build

I am trying to push a unity app to the app store (this is a first for me).
Unity builds the project fine, however when I import it in XCode, Archiving or building doesn't work.
The problem occurs when precompiling Prefix.pch
I need to use the geolocalization of the device in order to run my app.
I think that is what creates the framework related issues I am getting (it seems that the errors are in the APK and not in my code).
There files that are giving me errors are located in ios15.5>Frameworks>CoreLocation
I suppose CoreLocation is not imported ?
I did however try to Embed the CoreLocation framework in the Targets>General Tab like so but I have no idea if that is the way to do it:
I am definitely missing something but I don't know what to do at this point.
I am trying to do this using a mac mini with Monterrey OS, XCode 13.4, unity 2021.3.7.
My target os is iOS14.
If someone could give me some advice it would be greatly appreciated !
It seems this question was already answered here:
In the files generated by the unity builds, in
Libraries>Plugins>iOS>NAtiveToolkit
there are files named Locale.h and locale.mm that are conflicting with the Locale.h file of the project.
Renaming them to LocaleTools.h and LocaleTools.mm seemed to do the trick

Why RiveRuntime module is causing error every time I open Xcode project

Every time I open an existing swiftUI app which includes Rive animations it is saying no module named RiveRuntime. I have to create the project all over again to make it run.
Please give me a solution to resolve this issue.
It's because xcode is not able to fetch the framework everytime. You can download the framework and in the project settings choose the downloaded framework which works well without internet.

AudioKit 4.11.2 Playgrounds: "No such module AudioKitPlaygrounds"

It has been a year since updating so I downloaded AudioKit 4.11.2 yesterday. I built all of the frameworks, including the AudioKit and AudioKitUI xcframeworks.
Then I began playing with the Playgrounds. Right away Xcode tells me the build failed because it can't find the AudioKit frameworks. It appears that the Search Paths that are set in the original project file need tweaking so I set it to "$(inherited)../Frameworks".
Now it builds but still will not run, saying on the import AudioKitPlaygrounds statement that there is No such module AudioKitPlaygrounds.
Odd, because that is the target of the build and it exists in the Derived Data Products folder.
Searching through StackOverflow shows that AudioKit has had similar problems like this in the past but none of the proposed solutions seemed relevant to my situation.
What other tricks are necessary to get the Playgrounds running? Shouldn't it build and run straight out of the box without messing with the project search paths?
My environment is:
macOS 10.15.6
MacBookPro
Xcode 12.0.1
I ran through a similar problem with macOS 10.15.7, XCode 12.1 and AudioKit 4.11.2.
I got the same “No such module AudioKitPlaygrounds” message.
The "Build Active Scheme" option was unchecked in my File Inspector >> Playground Settings, so I checked it, rebuild the "Introduction and Hello World" .playground and it worked.
Edit (04/15/2021): David Thery gave a more complete answer in the following answers.
Also, make sure to:
run 'pod install' + automatically converting to swift5 in XCode
check "Build Active Scheme" as mentioned by Miguel FOR EACH single playgrounds you want to run.
run the playground with the play button in the editor, not the xcode main run button
If you want instead to use AudioKit in another XCode project, only two steps:
download AudioKit and AudioKitUI frameworks from here:
embed them in General > Frameworks, Libraries, and Embedded content, as shown on the screenshot below.
How did you build the frameworks? The assumption when it comes to the paths in other projects (including Playgrounds) is that they have been built via the build_frameworks.sh and build_xcframework.sh scripts in the Frameworks directory.
The end result should be a set of XCFrameworks in that same Frameworks directory, which is in turn referenced by examples and the playgrounds project.
To anyone still experiencing this issue, I just found a really simple solution. I was opening my playground files directly from 'Open Recent'. Problem is, Xcode doesn't automatically look at the parent directory and included files. Just close Xcode and open the AudioKitPlaygrounds.xcodeproj from finder. When you open your playground files from there they should work properly.

Failed to import bridging header FBSDKCoreKit/FBSDKCoreKit.h file not found

I am trying to add the Facebook login using Parse with swift and I have been following the iOS Developers guide. However it states swift compiler error: failed to import bridging header FBSDKCoreKit/FBSDKCoreKit.h file not found and the issue was found in the Test section on Xcode. Please can someone please help me to rectify this. Thank you very much.
I just solved this exact problem by actually copying the Facebook desired frameworks (in my case CoreKit, LoginKit and ShareKit) from the ~/Documents/FacebookSDK folder to the project folder.
To achieve that, I just dragged the frameworks into the project folder on XCode, but I CHECKED the option "Copy items if needed".
After that, everything worked in the first build.
I'm using Facebook SDK 4.7 and XCode 7.1.
I've had the same problem. I CHECKED the option "Copy items if needed" and build succeeded.
works for XCode 7.1 , Facebook SDK 4.7.1

How do I build frameworks in Xcode?

I'm trying to use the GData framework, so I downloaded it and it came as an Xcode project so I assumed I needed to build it. So I opened it up and and clicked run and it compiled fine, but where do I go to access the .framework it created? I'm new to frameworks and have only been using xcode for a month or two so you'll have to excuse my lack of knowledge about it.
The documentation will help you
Anyway, by default the target is GDataUnitTest, just change it to GDataFramework. Once you compile it you will find the framework in the folder of the XCode Project called target.

Resources