So i'm trying to create a binding for Card.IO in Android.
The error i'm facing now is "Classes cannot have multiple base classes". The line which the error is occurring on is shown below.
public sealed partial class CardIOActivity : global::Android.App.Activity, global::IO.Card.Payment.IN {
I've tried
<attr path="/api/package[#name='io.card.payment']/class[#name='CardIOActivity']" name="baseName">global::Android.App.Activity</attr>
but it didn't work. Any help is appreciated.
Related
I'm trying to add native swift code to my NativeScript app. According to these instructions in the documentation I can just add a swift source file to App_Resources/iOS/src/ and then use any publicly exposed classes directly in my TypeScript code.
Unfortunately this just doesn't work. I'll just get Cannot find name 'TestClass' and that's it.
Steps to reproduce:
Get a fresh NS project with ios tns create my-app-name --template tns-template-blank-ts
Update: I actually created the App with vue init nativescript-vue/vue-cli-template testapp. That seems to have caused the problems.
Add a TestClass.swift to App_Resources/iOS/src/
import Foundation
public class TestClass: NSObject {
#objc public func echo(param: String) -> String {
return param
}
}
Instantiate it in any TypeScript source file let instance = new TestClass()
Do tns debug ios
Compilation will fail with Cannot find name 'TestClass'
I have also tried generating TypeScript typings with TNS_TYPESCRIPT_DECLARATIONS_PATH="$(pwd)/typings" tns build ios or or just delcaring it as any with declare let KeyCommander: any; to eliminate the possibility that this is a TS related problem. The first approach doesn't generate any typings for my custom class so the TypeScript code will still not compile. The second approach let's the TS code compile but crashes on execution with JS ERROR ReferenceError: Can't find variable: TestClass.
I have also verified that the swift file is indeed getting compiled by inserting a syntax error which will crash the build process.
My NativeScript version is 6.4.0.
What am I missing?
Update: I just realized I actually created the App with vue init nativescript-vue/vue-cli-template testapp. I verified that as mentioned Tyler Blake's answer in an app created with the tns cli the described process actually works. In an app I just freshly created with vue init it doesn't, the objc!nsswiftsupport.d.ts is not being generated.
The question now is: What's causing the difference?
I followed your steps and I was able to get the typings to generate in objc!nsswiftsupport.d.ts. After you generate typings do you have that file with these contents?
declare class TestClass extends NSObject {
static alloc(): TestClass; // inherited from NSObject
static new(): TestClass; // inherited from NSObject
echoWithParam(param: string): string;
}
This shows that NS is able to pick up the Swift code.
All you need to do now is add tns-platform-declarations then in the references.d.ts file, add a line that points to the objc!nsswiftsupport.d.ts file. Then you'll get intellisense in your TS code.
Something like this:
/// <reference path="./typings/objc!nsswiftsupport.d.ts" />
Hope this helps!
I was able to solve the problem by inspecting the differences between the templates created with tns-cli and vue init. The difference is that the vue init template ships with an outdated version of the nativescript platform. You can just simply change
"tns-ios": {
"version": "6.0.1"
}
to version 6.4.0 (which the version the tns-cli template comes with) and then the process will work as described in the documentation.
I am putting an angular portion into my MVC app. As such, I have added a tag to my layout view to find the Angular source code, and this is working great.
My issue arises in trying to add a 3rd party module to my project. I added it through the package.json with no problem, and added the module to my app.module.ts as follows:
import { FileUploadModule } from 'primeng/fileupload';
The reference is found, Visual Studio is happy, everything is fine. However, when I run the project locally, I get the following 404 error:
GET http://localhost:59911/src/primeng/fileupload 404 (Not Found)
It seems to me likely that the tag is causing the issue, but I can't remove it without killing the rest of the Angular functionality. Any hints? Can I add an override to the imports call?
Thanks, Mike
On PrimeNG's official website they suggested using import { FileUploadModule } from 'primeng/fileupload'; but it doesn't work any more. I guess they didn't update the docs.
You need { FileUploadModule } from 'primeng/primeng';
The structure is
In the primeng.d.ts file PrimeNG re-exported all modules.
export * from './components/fileupload/fileupload';
For now, no matter which PrimeNG module is used, it is all from primeng/primeng. Here's the imported modules in my project:
import {
ButtonModule,
CodeHighlighterModule,
ConfirmDialogModule,
FieldsetModule,
FileUploadModule,
GrowlModule,
MessagesModule
} from 'primeng/primeng';
The version I use is "primeng": "^4.2.1"
The issue was that primeng was not in the mapping, so it was looking for it in src.
I added the following to systemjs.config.js:
in maps:
'primeng': 'npm:primeng',
in packages:
primeng: {
defaultExtension: 'js'
}
Thanks for the help everyone!
I am using the AlexTouch.googleAdMobAds project for displaying ads. Unfortunately it shows the error below:
static UIWindow window;
static GADBannerView adViewWindow;
static bool adOnWindow = false;
Error:
Error CS0012: The type MonoTouch.UIKit.UIView' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (CS0012) (OnlineVideos.Ui)
How can I solve this issue? Can anyone help please?
Add a using clause to include UIKit:
using UIKit;
Xamarin.iOS Only Nuget:
<package id="Xamarin.Google.iOS.MobileAds" version="7.6.0.1" targetFramework="xamarinios10" />
UPDATE 2: Xamarinos.AdMob.FormsPlugin Nuget
A Xamarin.Forms based PCL version # https://github.com/LosXamarinos/Xamarinos.AdMob.FormsPlugin
Nuget: https://www.nuget.org/packages/Xamarinos.AdMob.FormsPlugin/
UPDATE: See this forum thread concerning AlexTouch.GoogleAdMobAds being outdated:
https://forums.xamarin.com/discussion/7935/admob-with-alextouch-googleadmobads
I am the author of AlexTouch.GoogleAdMobAds it is really outdated now please use either the component
https://components.xamarin.com/view/googleadmob/
or the more up to date binding
https://github.com/mono/monotouch-bindings/tree/master/GoogleAdMobAds
I would suggest the component over the manual binding it's just easier ;)
I note the the mono android port of the SDK API Demos does not include the DeviceAdministration pieces.
Is this because it (DeviceAdmin) doesnt work? I have tried to make a small sample app and have not succeeded.
EDIT: Well I got a fair way in, now my problem is that I cannot generate the receiver/meta-data clause
I am on my way to writing my own aapt.exe to intercept the xml file on its way through this seems like a lot of heavy lifting
You can use the [BroadcastReceiverAttribute] custom attribute to generate the <receiver/> element, and you can use the [MetaDataAttribute] custom attribute to generate the <meta-data/> element:
[BroadcastReceiver]
[MetaData ("foo", Value="bar")]
public class MyReceiver : BroadcastReceiver {
}
Would generate the XML fragment within AndroidManifest:
<receiver android:name="generated-by-mandroid">
<meta-data android:name="foo" android:value="bar" />
</receiver>
I am using flex 4 and I want to custom the preloader, but I meet error of DownloadProgressBar. The code:
public class MyPreLoader extends DownloadProgressBar
{
var progress:ProgressBar = new ProgressBar();
Or substitude ProgressBar to Label will produce the same error:
Error: Could not find compiled resource bundle 'collections' for locale 'en_US'.
Anyone has implemented the custom preloader? I am almost missing here.
Resolved by adding:
[ResourceBundle("")] tag in the source!
Hope this can help others.