Hyperloop is re-writing source JS then failing subsequent clean builds - appcelerator

I've just updated to the latest 5.2.0.GA and am trying a simple Hyperloop test app.
Building the app causes references to hyperloop code in the source JavaScript to be re-written. Then it will fail the next rebuild due to Skipping Hyperloop compile, no usage found ... error, since JS code was re-written...
Reference here and here
Environment :
OS X : 10.10.5
node -v : v0.12.7
Studio : 4.5.0.201602170821
TiSDK : 5.2.0.GA
ti -v : 5.0.6
appc -v : 5.2.0
hyperloop: 1.1.0
Create new Classic Single Window Application mobile app project. Test build.
Add hyperloop requirements to tiapp.xml
<plugins>
<plugin>hyperloop</plugin>
</plugins>
<modules>
<module>hyperloop</module>
</modules>
and
<ios>
<run-on-main-thread>true</run-on-main-thread>
<use-jscore-framework>true</use-jscore-framework>
</ios>
As per example code in the "Hyperloop for iOS Programming Guide" PDF, I attempted to add a simple red UIView. ( In /Resources/ui/common/FirstView.js )
//FirstView Component Constructor
function FirstView() {
//create object instance, a parasitic subclass of Observable
var self = Ti.UI.createView();
//label using localization-ready strings from /i18n/en/strings.xml
var label = Ti.UI.createLabel({
color:'#000000',
text:String.format(L('welcome'),'Titanium'),
height:'auto',
width:'auto'
});
self.add(label);
//Add behavior for UI
label.addEventListener('click', function(e) {
alert(e.source.text);
});
// Test native view
var UIView = require('UIKit/UIView'),
UIColor = require('UIKit/UIColor'),
CGRectMake = require('CoreGraphics').CGRectMake;
var view = UIView.alloc().initWithFrame(CGRectMake(0,0,100,100));
view.backgroundColor = UIColor.redColor();
self.add(view);
return self;
}
module.exports = FirstView;
In terminal, run : appc ti build -p ios -f
The app launches. A small red view is seen in the top left corner.
All good.
BUT when I look back at the source JavaScript FirstView.js, the references to the native UIView, UIColor and CGRectMake have been edited. (I also notice that the build process created hyperloop folder within the Resources folder containing what appears to be the location of the newly edited references:
var UIView = require('hyperloop/uikit/uiview'),
UIColor = require('hyperloop/uikit/uicolor'),
CGRectMake = require('hyperloop/coregraphics/coregraphics').CGRectMake;
NOW when trying to build the app again using
appc ti build -p ios -f - the build fails with this error during the Hyperloop assembly :
...
[INFO] Starting Hyperloop assembly
[INFO] Skipping Hyperloop compile, no usage found ...
An uncaught exception was thrown!
callback is not defined
callback is not defined
Anyone have any ideas? I know this is beta, but am I missing a flag?
BONUS BUG: The -f force clean build flag does not appear to be cleaning out the build/hyperloop folder.

Related

SkiaSharp SKSvg.Load throws MissingMethodException

I use SkiaSharp libraries on my Xamarin.Core/Xamarin.iOS project.
I try to load an SVG file from the Core library like the following;
var svg = new SKSvg();
Assembly assembly = type.GetTypeInfo().Assembly;
using (Stream stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.Images.watermark_light.svg"))
{
svg.Load(stream);
}
The code throws on the "Load" step saying "System.MissingMethodException: Method not found: SkiaSharp.SKTextBlob SkiaSharp.SKTextBlob.CreatePositioned(string,SkiaSharp.SKFont,System.ReadOnlySpan`1<SkiaSharp.SKPoint>)"
My configuration:
Device: Debug|Simulator
Linker Behaviour: Don't link
Xamarin.iOS 15.4.0.0
xcode13.2: 8fc41ae82
Rider IDE: RD-221.5591.20
OS: MacOS Monterey 12.4 (21F79)
Libraries
SkiaSharp v2.88.1-preview.79
SkiaSharp.Views v2.88.1-preview.79
Svg.Skia v0.5.14
SkiaSharp.Svg v1.60.0
CoreLibrary/Images/watermark_light.svg(svg path)
I tried to add SKTextBlob reference to LinkerPleaseInclude.cs as well. But, it should not be the case when the linker behaviour is set to "Don't link". Also a added --linkskip argument for the relevant namespace. None of them worked. Any ideas about the issue?
Thanks!
Try updating to version 0.5.16 https://www.nuget.org/packages/Svg.Skia/0.5.16

Platform Migration: Error when compiling project

A few weeks ago I started a Firebase course with flutter, and I was programming on a Windows computer, and now I've been using a Mac for a few days, to learn how to make firebase with iOS too. However, I have received these errors, and I do not know if I am missing a file, lines of code or if I have obsolete code. I tried some solutions I found on the internet, like deleting the files pubspec.lock, podfile, podfile.lock, reinstalling using pod init and pod install, but none of these solutions managed to solve the problem. I know very little about Swift / Objective-C, and this project is connected (android) on firebase.
/Users/mobileteam/Desktop/pasta_mary/aikoBot/aiko_bot/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m100:11: warning: 'UI_USER_INTERFACE_IDIOM' is deprecated: first deprecated in iOS 13.0 - Use -[UIDevice userInterfaceIdiom] directly. [-Wdeprecated-declarations]
switch (UI_USER_INTERFACE_IDIOM()) {
^
In module 'UIKit' imported from /Users/mobileteam/Desktop/pasta_mary/aikoBot/aiko_bot/ios/Pods/FirebaseCrashlytics/Crashlytics/Shared/FIRCLSFABHost.m:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:97:36: note: 'UI_USER_INTERFACE_IDIOM' has been explicitly marked deprecated here
static inline UIUserInterfaceIdiom UI_USER_INTERFACE_IDIOM() API_DEPRECATED("Use -[UIDevice userInterfaceIdiom] directly.", ios(2.0, 13.0), tvos(9.0, 11.0)) {
^
1 warning generated.
/Users/mobileteam/Desktop/pasta_mary/aikoBot/aiko_bot/ios/Runner/AppDelegate.swift:14:18: error: cannot override with a stored property 'window'
override var window: UIWindow?
^
Flutter.FlutterAppDelegate:2:14: note: attempt to override property here
open var window: UIWindow! { get set }
^
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

IPA Processing Failed when Arching Project using Xcode 11

I have been trying to archive a project of mine and cannot get it to work. I have looked at other suggestions including, removing x86_64 and i386 from frameworks to no avail and I have messed with all of the build setting/phases.
My project is not using Carthage just Cocoa Pods and they are all up to date.
When it fails to archive I clicked "Show Logs" and at the very bottom it says the following:
alerts = (
{
code = 3620;
description = "Configuration issue: platform AppleTVSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
info = {
};
level = WARN;
},
{
code = 3620;
description = "Configuration issue: platform WatchSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
info = {
};
level = WARN;
},
{
code = 3620;
description = "Configuration issue: platform iPhoneSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
info = {
};
level = WARN;
}
);
UPDATE: I don't think it is a framework issue as another application I have uses the same frameworks and archives fine.
I had the very same issue 'IPA processing failed' along with these warning.. Current workaround is to press enter as soon as the App thinning window appears while archiving, as the “Next” button has the focus, or being super fast clicking on it.
And make sure to "Uncheck" the bitcode check while creating the IPA.

How do I bind to a system framework with Xamarin.Mac?

I'm in the proces of making an app for interacting with smartcards.
For that I'd like to use the CryptoTokenKit Framework which is standard on a Mac (located at /System/Library/Frameworks/CryptoTokenKit.framework).
This link says that it's possible to bind frameworks in a Mac project:
https://developer.xamarin.com/guides/cross-platform/macios/native-references/
I've created an ApiDefinition.cs file and a StrucsAndEnums.cs file using the following sharpie command:
sharpie bind -framework ./CryptoTokenKit.framework -sdk macosx10.13 -o ~/CryptoTokenKitBinding
I can't find any info on the internet how to implement the above mentioned files and start using the framework.
Create a Xamarin.Mac binding project within a solution.
Add a NativeReference to:
/System/Library/Frameworks/CryptoTokenKit.framework
Bind it using sharpie:
sharpie bind \
-o CryptoTokenKitFramework \
-namespace CryptoTokenKit \
-sdk macosx10.13 \
-f /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CryptoTokenKit.framework
There is a mismatch between the binding project template and the output of sharpie, so you can either delete ApiDefinition.cs and add ApiDefinitions.cs or just overwrite the template created one:
mv CryptoTokenKitFramework/ApiDefinitions.cs CryptoTokenKitFramework/ApiDefinition.cs
There will be a number of attributes like (versions will change across them):
[Watch (4,0), TV (11,0), Mac (10,12), iOS (10,0)]
As these are private frameworks on iOS, Watch, TV, so strip those platforms out. Leave the Mac attribute and the original version:
[Mac (10,11)]
Note: PlatformAttribute is obsolete but sharpie is still using it (assuming backwards version compatibility(?)), so you can use Introduced if you really want to clean up the build output:
[Introduced (PlatformName.MacOSX, 10, 11, PlatformArchitecture.Arch64)]
There will be a few [Verify] attributes that have to be reviewed/corrected. i.e. TKSmartCardUserInteraction.Cancel and TKSmartCardSlot.MakeSmartCard should both be methods not properties.
Example / Generated:
// -(TKSmartCard * _Nullable)makeSmartCard;
[NullAllowed, Export ("makeSmartCard")]
[Verify (MethodToProperty)]
TKSmartCard MakeSmartCard { get; }
Corrected:
// -(TKSmartCard * _Nullable)makeSmartCard;
[NullAllowed, Export("makeSmartCard")]
TKSmartCard MakeSmartCard();
Fix the rest of the [Verify] attributes and compiler errors, there are a bunch of bad method signatures, pointers, return types, etc.. that are generated and need corrected.
Note: TO make your life easier, make sure that you are using the latest Sharpie version:
Version: 3.4.0
SHA1: c12859dac8d43121b5a9ed866a0db8409f9df817
URL: https://dl.xamarin.com/objective-sharpie/ObjectiveSharpie-3.4.0.pkg

Xcode equivalent of Visual Studio's "Find Source"

I am developing on a Qt project, and have installed Qt from their installer onto my computer. In Visual Studio it is simple to debug-step into Qt sources: when I enter a function in an unknown file, it will open a file browser to let me locate the original Qt source code.
Is there an equivalent function in Xcode or LLDB?
The debug information records the location of the QT source files when they were built. You can find this information by doing:
(lldb) image lookup -va main
Address: hello[0x0000000100000f40] (hello.__TEXT.__text + 0)
Summary: hello`main at hello.c:5
Module: file = "/private/tmp/hello", arch = "x86_64"
CompileUnit: id = {0x00000000}, file = "/tmp/hello.c", language = "ISO C:1999"
Function: id = {0x00000026}, name = "main", range = [0x0000000100000f40-0x0000000100000f6d)
FuncType: id = {0x00000026}, decl = hello.c:4, clang_type = "int (void)"
Blocks: id = {0x00000026}, range = [0x100000f40-0x100000f6d)
LineEntry: [0x0000000100000f40-0x0000000100000f56): /tmp/hello.c:5
Symbol: id = {0x00000004}, range = [0x0000000100000f40-0x0000000100000f6d), name="main"
but substitute some QT function for "main". Then look at the CompileUnit line and see what the "file" entry says. Suppose it says
"/BuildDirectory/sources/SomeSubdirectory/SomeFile.cpp"
Now presumably you've downloaded the QT sources, and they live somewhere on your local machine, say in
"/Users/ME/QT/sources"
So what you want to do is tell lldb: "when you see a source file rooted at /BuildDirectory/sources, look in /Users/ME/QT/sources instead." You do that with the lldb "target.source-map" setting. In this example, you would say:
(lldb) settings set target.source-map /BuildDirectory/sources /Users/ME/QT/sources
You can type that in on the command line or put it in your .lldbinit file for more general use. lldb will update its source maps automatically, but if you are running in Xcode, you'll have to step once after issuing the command to get it to update.

Resources