Clean Google Cardboard SDK project won't compile - xcode

What I did:
I created new project using Unity 3D
switched target to iOS
imported new custom asset "GoogleVRForUnity unitypackage"
created new blank C# behaviour script
hit "compile" in MonoDeveloper
What I got: Compile error "The type or namespace name "Xcode" does not exist in the namespace "UnityEditor.iOS. Are you missing an assembly reference?"
in
using UnityEditor.iOS.Xcode;
in /Assets/GoogleVR/Legacy/Editor/GvrViewerEditor.cs
I changed nothing. Is this a bug? How to fix this?
When I build for iOS from Unity Editor, run XCODE project on my device, everything works as expected.
OS X 10.11.6 (15G31), Unity 5.4.0f3, Google VR SDK seems to be latest (downloaded repo directly from "https://developers.google.com/vr/unity/download")
Of course I have "iOS build support" component.

Solved it.
Should've added .NET reference to:
"/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll"
I wonder why it wasn't referenced in the first place.

Related

Xamarin.Forms iOS app in Release mode Community Toolkit TouchEffect command not firing

I have a Xamarin.Forms application with an Android and iOS version. The Android version is working fine in both Debug and Release mode.. in fact the Android version is already in the Play Store.
However the iOS version has an odd issue. In debug mode it works perfectly, however in Release mode everywhere I use the Xamarin Toolkit TouchEffect in order to attach a Command to an element, does not fire.
<buttons:BackButton xct:TouchEffect.Command="{Binding BackCommand}" xct:TouchEffect.NativeAnimation="True" />
I looked online and apparently this could be a linker issue since maybe the linker is stripping this code from the final build, however I have it set to "Link Framework SDKs only" which seems to be the recommended setting when publishing your app.
Is there something else I may be missing?
Thanks
So after a lot of research indeed the bug is with the linker, which is stripping some Community Toolkit code from the release build, despite the fact that I am using the toolkit in xaml. One thing to note is that I'm only using the toolkit in Xaml.
By simply creating a class in the iOS project file with the below code, the linker sees that I indeed need this package and doesn't strip it's code.
public class LinkerPleaseInclude
{
public void Include(Xamarin.CommunityToolkit.Effects.TouchEffect arg)
{
var dummyCommand = arg.Command;
var dummyCommandParameter = arg.CommandParameter;
var dummyNativeAnimation = arg.NativeAnimation;
}
}
Edit: this may not be enough to solve the issue. If it still persists, try include ‘--linkskip=Xamarin.CommunityToolkit’ inside Additional mtouch arguments of iOS Build screen. That should do it.
If anyone is facing this issue on Android platform we can fix it by adding Xamarin.CommunityToolkit; in "Ignore Assemblies" Entry in "Android Build -> Linker" section.
For some reason when we keep Linker Behaviour as "Don't link" then also not taking these assemblies.

Xcode- Library not found for - IGoogleUtilities

I am new to Apple and Xcode, I make an application in unity3d and I try to implement AdMob. When I Run for test in xCode I have the error: Library not found for- IGoogleUtilities.
https://imgur.com/a/RTDZPYw
Also when I select "Simulator SDK" from Build Settings/Player Settings/Other Settings the build Button is interactable
Maybe it'il help someone;
"When using Unity 5.6 and above, an xcworkspace is generated that includes the required dependency libraries. Use the generated xcworkspace instead of the standard Xcode project."
Select device SDK from Unity editor.
inside Xcode, You should download and add GoogleMobileAds.framework then rebuild.
Let me know if it helps.

Bitrise Xamarin build fails with message "No exportable output found"

I'm trying to setup my first custom Xamarin IOS build on Bitrise. i manage to have the sample app building. I tried to create a build for a custom IOS single page app and I'm getting the same error.
["\"/Applications/Xamarin Studio.app/Contents/MacOS/mdtool\"", "build", "\"-c:Debug|iPhoneSimulator\"", "\"tamtammeapp.sln\"", "\"-p:TamTamMe.IOS\""]
Xamarin Studio Build Tool
Loading solution: /Users/vagrant/git/tamtammeapp.sln
Loading projects ..
Building: TamTamMe.IOS (Debug|iPhoneSimulator)
generated_files: {"{AE5511D0-5224-4AC5-B25F-BDFB1851FB67}"=>{:app=>"./TamTamMe.IOS/bin/iPhoneSimulator/Debug/TamTamMe.IOS.app", :api=>"ios"}}
No exportable output found
I cannot figure out what I'm doing wrong. Any idea?
Thanks,
The step xamarin-builder is expected to generete platform specific archives (.APK file for Android, .ipa file for iOS, .pkg/.app for Mac), the error means building your project with given configuration:
platform: iPhoneSimulator
configuration: Debug
does not generate .ipa file.
Most of the times, platform: iPhone generates .ipa as output, so try to change the platform (but it depends on your project settings).
Check out your ios project settings by double cliking on your project, in the project navigator, select iOS Build tab in the Project Options menu, Under Code Generation & Runtime you can find Supported arhictectures, xamarin-builder step will generated .ipa for configuration-platform combination, where architecture is ARMx.

Playground Import: No Such Module 'Foo'

I've diligently followed the Apple instructions to import a custom module into a playground, including the instructions here. And yet I get:
Playground execution failed: /var/folders/z3/kd0nj4ln1rgcpm8bdz7067wh0000gs/T/./lldb/1874/playground1.swift:7:8: error: no such module 'Foo'
import Foo
How can I recover to a working Playground import? [Edit: Note, two answers have produced detailed instructions to associate a playground with a framework; I have followed those instructions but no luck. The solution will need to involve reconfiguring something in Xcode; my installation is apparently broken]
Detailed images of the error and attempts:
Here is another attempt, based on the answer of #EricD, showing the directory structure, no dice.
For some of those that none of the above solutions work (and that Xcode build path setting was already set to Unique), I've found a solution.
The framework must be built with a scheme for an iOS simulator device (any in the list) and NOT a Generic iOS Device, as Playgrounds do not support it. This one worked for me :
Here's how I proceed for OS X with Xcode 7.1:
Create new project: OS X Cocoa Framework, Swift. For this example I named it "TestPlaygroundFMK".
Create a new Swift file.
Add a class to the file. The code has to be public. I made this for our example:
import Foundation
public class Talk {
public class func sayHello() {
print("Hello from framework!")
}
}
Build the project now.
In the menu bar, click on File > Save As Workspace.
Create a new Playground and save it inside the project folder next to the Swift files.
The Playground must not have the same name as the project.
Build the project again.
Import your framework in the Playground and use it:
import TestPlaygroundFMK
Talk.sayHello()
I had my playground working fine but found that when I quit Xcode and re-opened it, I would get an error like this:
error:
/var/folders/ft/bmk8wh6s5ms4my2pxhn3qbp40000gn/T/playground1-9216e0..swift:3:8:
error: no such module 'Playground_Sources' import Playground_Sources
... where "Playground" is the name of my playground file.
The solution to this (in Xcode 9.0) is to:
click any playground file in your workspace
show the Utilities panel (opt-cmd-0)
under "Playground Settings" change the "Platform" to anything else then set it back.
In my case, it's set to macOS. I changed it to iOS then back to macOS (no recompilation necessary) and it started to work fine... that is until I close Xcode and open it again.
This is the only solution I found to work with macOS playgrounds. This bug still exists in Xcode 9.3.
I'm not sure i had the exact problem as the original question - but given the mix and age of solutions and the lack of this one that DID work for me, i thought I'd share.
In Xcode 11+ (tested this on 12.2), i'd often have Playgrounds fail to run givn the "No Such Module" error when it included a framework that is a part of the workspace.
The solution for me was in the "File Inspector" for the Playground, and the "Build Active Scheme" option:
This ensures the project was being built appropriately for the target, and now my annoying compile issues are gone!
Create a workspace as below:
Choose File > New > Workspace
Enter the workspace name, and specify its location in your file system
Click Save
Now, Create a Cocoa framework with swift file which have your class
Choose File > New > Project
Select Cocoa framework > Next
Enter Product Name and Language > Next
Before clicking create, in 'Add to:' and 'Group' list choose 'Your workspace name' as shown
Framework is added to your workspace
Create swift file in your framework
In Xcode right click on the folder where you want to add swift file and select new file...
Select swift > Next > Name your file > Create
Select your framework in Xcode -> Build your framework
Create playground -> Playground should also be part of your workspace, if not drag it to your workspace, it'll be added automatically.
Right click in Xcode's files section > New file... > Playground
import
Call your method
Note: If you just wanted to add classes instead of framework to your playground check the link How to import my own class into an Xcode 7 playground?
Solution that worked for me:
Setup your workspace and project/framework.
Delete derived data (How to remove derived data?)
DO NOT BUILD YOUR PROJECT YET
Create playground file with different name then your project/target/framework name under folder with either Swift files or where .xcodeproj is located (does not matter which one you chose)
Build your project under required platform (if playground is for macOS, then build project with macOS target, etc.)
When build finishes try adding some code to your playground and run it.
P.S. you might need to restart Xcode before 6th step.
The solution, from Apple Support, was to adjust my Xcode Preferences. On Locations :: Advanced my configuration was 'Legacy'. By changing to 'Unique', and undoing any paths I'd attempted to insert, Playgrounds can now import frameworks.
I don't think it's a stretch to say that Xcode is somewhat of a blackbox. I make no claim that this will work for anyone else, but for me, after having the same issue after creating a new playground and a new framework target, and all the other proposed solutions, what finally worked was deleting the workspace file and (in my case) regenerating it with cocoapods.
I have no idea why this worked.
Build the framework with release ,this worked for me. (Xcode 10.1, swift 4.2)
Insert a var at the first line and re run
var str = ""

Xcode - AudioToolbox/AudioToolbox.h file not found

I'm getting started with Xcode and a i'm studying the way to play sound. I have implemented a small project that play a sound using AudioToolbox framework. Everything was fine: i could Build and run normally, the application also functioned normal but today when i reopen the project i have this bug " file not found". It's strange, i didn't modify anything in my project, the framework was linked in my project too. Anyone has the same problem like me?
First try to clean your project by going to the menu bar (the very top) under "Product" and click "Clean". If it still doesn't work: go into the Build Phases, delete the frameworks, then re-add them.
If this happens when you take an old project and try to build with a new Xcode version, it could bet due to saving ".framework" files locally within your project. Do check the project folder for such files and remove them, and then use the "Build Phases" tab to link the new frameworks.

Resources