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

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.

Related

Xamarin.iOS 11 Resources are Not Loaded

I recently updated my instance of Visual Studio 2017 to version 15.3.5 and in the process updated Xamarin.iOS to version 11.0.0.0.
Since updating, several of the resources in my project have stopped working. When deploying to a device, the app icon is not displayed (instead blank icon is shown), and Bundle Resources like a custom font file (.tff) is no longer loading. There has been no code changes to the stable branch of our build, but just updating appears to have broken multiple resources.
Has anyone else encountered this? Does the Xamarin team know about this (I'm looking at you Xamarin folks who said to post my questions in SO)?
EDIT:
Here is the guide for updating an app (doesn't appear to apply to the issue I'm seeing): Xamarin Update to iOS11.
Here's a specific example of code that has suddenly stopped working despite no code changes:
UIFont customFont = UIFont.FromName("streamline-24px", (float)this.IconButton.IconSize);
The .tff file is the same, but FromName() yields a null value now.
I figured it out, hopefully this helps anyone with the same configuration that upgrades their Xamarin.Forms or Xamarin.iOS project from Xamarin.iOS release 10 to 11. I was lucky to happen upon it after reading Kevin Mullins answer at Xamarin saying that you should:
Ensure that all of you icon files are in place (either via the info.pst file or an Image asset).
My Info.plist > Visual Assets looked like this (which worked prior to the update)
Selecting Use Asset Catalog and selecting a value resolved the issue.

Clean Google Cardboard SDK project won't compile

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.

Swift debugger does not show variable values when importing ObjC framework

When I create a new OS X "Game" project with Sprite Kit, and set a breakpoint anywhere I can see the variable values just fine:
Then I change the code to import my own framework (TilemapKit) which is a pure Objective-C framework:
import SpriteKit
import TilemapKit
class GameScene: SKScene {
override func didMoveToView(view: SKView) {
print("dang!")
}
}
No other changes made. I'm not even using any of the TilemapKit code (yet). When the breakpoint triggers, I see this:
The entire project stops being debuggable as far as observing variable values goes. This behavior is perfectly consistent. Without the framework import I can debug again.
Since I'm on Xcode 7 beta (7A121l) and OS X 10.11 developer preview I know this could simply be a (temporary) bug.
Command line Tiles are set to use the Xcode 7.0 version btw. I tried enabling modules in the framework target, made sure the deployment target is the same (10.11), disabled symbol stripping. I added a Bridging Header and #imported the TilemapKit framework in it (removing the Swift import in that case would still give me the non-debuggable app, so it doesn't seem to matter how or where I import the framework).
Does anyone have a suggestion on what could cause this behavior and how I might go about fixing it - or at least how I could try to narrow down the issue?
Is the culprit more likely to be connected to the project's vs the framework's build settings? Do I need to enable something in the app project to make it compatible with ObjC frameworks? (I already got -ObjC in the Other Linker flags)
UPDATE:
I ran po self in the debug console and found this notice:
<built-in>:3:6: error: module 'TilemapKit' was built in directory '/TilemapKit.framework' but now resides in directory './TilemapKit.framework'
#define __clang_major__ 7
^
missing required module 'TilemapKit'
Debug info from this module will be unavailable in the debugger.
How come the framework build directory changed? And why would that matter and how to fix this?
PS: the same framework in a new ObjC app can be debugged just fine.
I got a message from an Apple developer stating that they've observed this problem, and that it could be fixed by moving the .framework to a subfolder of the project.
Apparently the module .. was built in directory error appears only if the .framework is in the same folder as the .xcodeproj aka $(PROJECT_DIR).
However moving the framework to a subfolder didn't fix the issue in my case, but it's still worth a try until this gets fixed in a newer Xcode 7 beta (still occurs in beta 3).
In my case this was happening because of redundant import statements in my project.
My project mixes swift and objc files, so I have import statements in the bridging_header.h file.
In my bridging_header.h I had #import blah.h
In one of the swift files, I was importing a redundant header from a framework
#import blah // From blah.framework
I removed the redundant import from the swift file, that seems to have fixed it.
I can confirm this is happening in Xcode Version 7.0 beta 4 (7A165t). I had to remove my ObjC framework to get Debugging values to return. If removing your framework isn't an option, the print method is old-school debugging, but still works.
I had this issue a while ago. In my case the Prefix.pch was beeing included inside the Bridging-Header.h. This is not a issue per so, but inside my Prefix.pch there was many C includes that make the lldb fail to import the Bridging-Header.
So I removed the "#import Prefix.pch" from the Bridging-Header and copied just the "#includes" to the obj-c files that I need to use in swift.
The Optimization level is not set to None for the Debug configuration.
Be sure to set it to None for Objective-C apps as shown in Figure 1 and for Swift apps as shown in Figure 2.
The Build Configuration pop-up menu is set to Release in the scheme editor's Run action settings pane.
In Xcode, open the scheme editor by choosing Product > Scheme > Edit Scheme…, select the Run action for your app in the scheme actions pane, then set Build Configuration to Debug as seen in Figure 3.
Go to Edit Scheme on left top corner.
And change the configurations to Debug, if it is release

iOS 8 Today widget does not appear when running the project

I have an app with 2 targets and added a today widget. When I run it it doesn't appear on the today notifications Edit/ in the "Do not include" section, where it normally appears the first time with my other apps. Any idea what could be going wrong? I get the entitlements missing warning for the extension but i get this for the ones that work too ( have tried adding one, doesn't help).
Also if i try attach it as a process under the debug menu, it does not appear there at all/
I have tried deleting app from simulator and resetting etc, I have tried with another app that has multiple targets as i thought this may be the problem but the other one works.
Anyone else have a similar experience or can suggest anything?
Edit 6 Oct 2014: I still haven't found a solution, but my project does not use arm64. Could this be the issue ? i have tried removing arm64 from other projects but I think Xcode 6 doesn't allow it so I can't test it, does anyone know if this is a possibility?
In my case, the reason for the widget not being shown in the list of widget was a too high deployment target number. For the widget, I had 9.0. However, I downgraded my iPhone from 9.0 to 8.4 and forgot to change it for the widget.
After changing it to 8.4, the widget immediately appeared on the iPhone.
Make sure you're running the containing app not the extension in the simulator.
I have seen this issue when there is a mismatch in the bundleID between the app and the extension.
Example (Correct):
App bundleid: com.yourcompany.myapp
Ext bundleid: com.yourcompany.myapp.myextension
The extension needs to have the entire bundleID of the app, followed by its own name.
Make sure:
"Deployment Target" is same to containing app's (#vomako 's answer);
Bundle ID follows correct format: "com.yourcompany.myapp.myextension", while your containing app's is "com.yourcompany.myapp" (#RohitGupta 's answer);
While debugging, you need to run widget/extension scheme (not containing app's scheme here. But if archive to submit to App Store, use containing app's scheme);
"Build Settings"'s "WRAPPER_EXTENSION" is "appex".
Point 4 was not mentioned in all answers (even official doc), but happened in my case.
I created Today Widget for my existing project in a workspace, not works at all. However, when I create pure new project with Today Widget, it works well. Then I compare the Build Setting one by one and found this difference: The one created for my existing project is "app", not "appex".
After changing it to "appex", works.
Also, as tips, in order to pass App Review, you must:
Include the arm64 (iOS) or x86_64 architecture (MacOS) in widget/extension's Architectures build settings;
Specify “iPhone/iPad” (sometimes called universal) as the targeted device family for your app extension, no matter which targeted device family you choose for your containing app;
A containing app that links to an embedded framework must include the arm64 (iOS) or x86_64 (OS X) architecture build setting;
Always choose “Frameworks” as your Copy Files build phase destination (do not choose the “SharedFramework” destination instead).
In my case the Build phase "Embed App Extensions" of the app target was missing the appex file:

How to run ios 4.3 app in ios 4.0

How to run application which is build using ios-sdk-4.3 in ios-sdk-4.0.I set build target but also am getting lots of crash.
Thanks.
I don't know if I understand your question correctly but try following:
Assuming you are using XCode4, double click on your Project
file to open your Project settings (that's the first Item in your Project Navigator).
Selecting the INFO Tab, choose your Deployment Target, for example 4.0.
I can't help you with the crashes but please try to use the debugger to find out which part of your application is causing the issues.
Let me know if that answers your question

Resources