blackberry cascades mapview - blackberry-10

Hi I am trying to implement a mapview using blackberry cascades based on this link but whenever I import maps
import bb.cascades.maps 1.0 ,
the QNX IDE throws out an error saying
bb.cascades.maps is not installed.
I have set up the environment exactly as described in the developer site and dont seem to understand how do i install this module.

They seem to have left out some steps. Not all cascades objects are loaded by default into the development system, but they can be added at runtime. The biggest drawback is that the Eclipse can't do static analysis of the QML for errors only general syntax.
If you add the following lines to the main.cpp file you may get the example to work (I hacked this into one of my current projects and got it to load without errors but the MapView is all black):
#include #include <bb/cascades/maps/MapView>
Then just before the QmlDocument::create call:
qmlRegisterType<bb::cascades::maps::MapView>("bb.cascades.maps", 1, 0, "MapView");
This is the mechanisim that is used quite frequently to make Cascades objects not included in the default setup available, or to make your own specializations from CustomControl or other Cascades objects available to QML.
Finally this example seems to pre-date beta 3 so there may be some other issues that you may have to work through.
EDIT
I did some poking around and found this thread on the BlackBerry forum. Setting the altitude to 10000 actuall got me a usable map on the simulator and the Dev Alpha. It obviously needs more work but you can interact with it (drag to move, pinch to zoom, etc).

The MapView component seems to have been largely unusable until the most recent SDK update (10.0.9.2318), as somewhat admitted and referenced by this Blackberry DevBlog post:
http://devblog.blackberry.com/2013/01/cascades-mapview/
Also, check out the new CustomMapView example on Github for a working sample app using this latest update:
https://github.com/blackberry/Cascades-Samples/tree/master/custommapview
For the QML preview issue, this is known issue. QML Preview currently only supports the core cascades components. See my more detailed answer here:
blackberry 10 Unresolved inclusion <QObject>

Related

TypeLoadException after loading .NET 4.5 C# DLL into Unity 2018.2.5

I want to be able to feed the camera frames from a webcam into Unity. I made a .NET 4.5 C# DLL using MediaFrameReader and event listeners. Here is some other user's implementation for accessing the Hololens camera frames: Hololens - Access Camera Frames.
When I import the DLL into my 2018.2.5 Unity project, it gives me the following error:
Unloading broken assembly "....", this assembly can cause crashes in the runtime
TypeLoadException: Could not find method due to a type load error
The C# plugin built successfully many times on Visual Studio. Also, I have properly set the Api Compatibility Level (in player settings) to .NET 4.x. What could be the fix to this?
All the other SO answers related to this I have already taken a look, but does not seem to help the problem. Thanks for all the help.
EDIT: https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception is the most relatable post, but had no solution.
I have few possible solutions for you to explore.
DLLs issues:
Workaround:
Comment your UWP code (the part that uses the DLL), then build it in UNITY without the DLL. In the generated UWP solution, install the package from nuget or manually import the dll, then uncomment your code and finish your development. This is a short-term solution.It is going to be annoying as you re-build your solution many times and have to comment/uncomment then re-add dlls and so on.
Other possible solutions:
Failed to run reference rewriter with command error with unity error when adding a DLL to the assets folder
Your exact need
From your description, you really do not need everything in the link you referenced (Hololens - Access Camera Frames). You need much simpler version. I recently created MediaCapture solution for HoloLens as a workaround because PhotoCapture in Unity is not working in the HoloLens and everything is working without any additional DLLs. I will post for you few links to see if it may help you:
MediaCapture Unity & HoloLens: https://github.com/MSAlshair/HoloLensMediaCapture
This maybe a good start for you. You can combine it with your original reference. Use this project as starting point to make sure your project is building correct, then use the necessary code from the other resource that you posted to accomplish the task that you desire. You may need to download Unity 2018.2.12f1 because I didn't test it in 2018.2.5
MediaCapture & PhotoCapture: Hololens font camera
Good Luck!

React Native with Unity

Does anyone have any experience combining React Native and Unity? I'm looking to start a Unity project that's very UI Heavy and I'm thinking about using React Native to take advantage of its UI capabilities on mobile and web.
I'm curious what the workflow for such an approach would be.
Finally after a lot of trials managed to do this. These are the steps.
1) Using this link, export android project for Gradle.
Select Gradle in the Build Settings window and check the Export Project checkbox.
Click Export and select the destination folder.
2) Import the generated folder in Android studio. Select ok whenever prompted. In this process, you will encounter following issues
2a) Gradle Sync Failed due to org.gradle.api.internal.tasks issues. Resolve using this link
3) Create React Native App using this link
4) Start Integrating Android exported folder inside created react native app using this link. Don't upgrade Gradle as Android studio will ask you again and again. You will encounter following issues. Don't go through "Test Integration" until you are finished with #5 here.
4a) While configuring maven, use this url for maven url "$rootDir/../node_modules/react-native/android" .
4b) While configuring maven, if you encounter problem related to javax.inject:javax.inject". Use this link.
4c) You may also encounter this error "Conflict with dependency 'com.google.code.findbugs:jsr305'". You can solve this link.
4d) During Code integration section of this link, focus on the following section: If you are using a starter kit for React Native, replace the "HelloWorld" string with the one in your index.android.js file (it’s the first argument to the AppRegistry.registerComponent() method). Here you have to replace with project name.
5) Before going through "Test your Integration" section, you have to add code to call MyReactActivity from UnityActivity. This link will help.
6) Go through "Test your Integration" section of link provided in #4. You may encounter following problems.
6a) unable to load script from assets index.android.bundle. Use this link.
6b) could not connect to development server on android. Use this link.
Check my article on Medium
I've shown with an example on How to integrate react native with Unity 3D step by step. My aim was to use the react native within the Unity3D like a module which is quite convenient if you're gonna heavily work on Unity 3D. Hope this helps for someone who comes here later.
I'm unsure as how a Unity game is built for iOS, if it uses Cocoa Touch for rendering its core classes.
If it does, and you have access or ability to render a UIViewController then you can render your React Native application. The only thing you would have to facilitate is setting up communication between the two applications.
Here is an example of rendering a native UI Component inside a React Native app that may help. http://moduscreate.com/leverage-existing-ios-views-react-native-app/
I was curious as well, and created an example project of how to do this for Android: https://github.com/marijnz/unity-react.
If this is a viable option, at least depends on:
How long the project will be running, both React and Unity have to be updated and this gets probably tougher over time.
The amount of sdk's/dependencies the project has.
If you want to do iOS as well.
In general, I'd probably avoid going this way.
Even though the example seems pretty simple now, it was a pain to get to that (as Shaunak's answer already hints at ;))

Building pure Swift Cocoa Touch Framework

I'm exploring Swift with Xcode-6 and so far so good although I think the new collections need a little bit of work as I've managed to break the compiler a few times.
Problem is I'm now stuck trying to create the framework package to then use in another project. The project builds without issue and all tests pass successfully. When I go to create Archive (which I assume is what is required) I receive the error:
:0: error: underlying Objective-C module 'Sample' not found
Now I assume this has something to do with the contents of my Sample.h which tells me
// In this header, you should import all the public headers of your framework using statements like #import <Sample/PublicHeader.h>
which is fine except I have only used swift enums, structs and classes for this framework so therefore no .h files exist.
Can anyone shed some light on this one as I can't find any documentation available yet?
EDIT (7/27/2018)
The information in the answer below may no longer be accurate. Your mileage may vary.
I sat down with an engineer and asked this exact question. This was their response:
Xcode 6 does not support building distributable Swift frameworks at this time and that Apple likely won't build this functionality into Xcode until its advantageous for them to do so. Right now, Frameworks are meant to be embedded in your app's project, rather than distributed. If you watch any of the session videos or see the sample projects, this is always the arrangement. Another reason is that Swift is very new and likely to change. Thus your Swift-based framework is not guaranteed to work on the platform you originally built it on.
Slight Update
The engineer mentioned that it's not impossible to make a framework for distribution, just that it's not supported.
I was able to get past the error by going to the target for the framework and on the Build Phases tab under Headers, remove the MyFramework.h file
However I was getting the "Underlying Objective-C module not found" error when I was using a framework to share code between a containing app and an app extension, both of which were pure Swift.
Assuming you are creating a truly pure Swift module, you must disable the Objective-C Compatibility Header and any generated interface headers so the compiler doesn't go off assuming it can find an Objective-C module for the framework.
Do Not remove your public framework header. You'll get a module-map warning at link time if you do.
You might find this useful: Creation of pure swift module
In short: it's possible to make static framework, but there is one issue: it doesn't work in end user' project if "ProjectName-Swift.h" header included.
But, it works fine if you use only swift.
I think it's a bug in XCode 6, or that Apple does not allow archiving the Framework from XCode while in beta.
If you compile to profile XCode generates the framework correctly. (See the Release folder created in DerivedData)

blackberry 10 Unresolved inclusion <QObject>

I'm using the new version of Blackberry (Blackberry 10) . I'm trying to integrate c++ code with QML , but I faced some problems that I thinks connected to other . in the .h file Q_OBJECT , Q_PROPERTY signals and slots shows that there is syntax error . and in the QML file in which I try to use this type (i.e import CustomTimer 1.0 for example) I got this problem module "CustomTimer" is not installed . how to solve this issue???
I'm using QNX Momentics Version 10.1.0
I resolved my errors by right-clicking on my project folder, then selecting Configure -> Add Library..., and then choose Standard BlackBerry Platform Library. Choose the relevant library to include and click Finish.
For QObject, I found it under Platform > Qt Core
I corrected the issue in following manner:
Right Click on your project in Project Explorer.
Goto Index.
click Rebuild.
For the syntax errors that you are reporting in QNX Momentics for the Q_OBJECT macros and other Qt macros, these errors went away for me after updating to the latest Momentics and SDK release. However, there are still some others who seem to have this issue, and some workarounds have been posted in the Blackberry Developer support forums:
http://supportforums.blackberry.com/t5/Cascades-Development/Beta-4-Momentics-IDE-autocompletion-does-not-work-for-Qt-classes/td-p/2014793
For the error in your QML file, I think you encountering a known limitation with the QML preview for custom components from C++ registered and imported into QML. The QML preview only understands how to display the core Cascades components. This should not affect how your code runs in the simulator or on an actual device.
See:
https://developer.blackberry.com/cascades/download/releasenotes/
under "Known Limitations":
QML preview with C++ objects The QML preview can load and render
components based on the Cascades plug-in only (in bb.cascades 1.0).
Objects that are registered in C++ in your project are not understood
by the QML preview and cannot be loaded and rendered.
In some cases, as a workaround in order to see the preview for the rest of your QML document, you can just comment out the import MyLibrary 1.0 when using the QML preview. However in some cases this could mean commenting out half of your document. For more than very basic QML layouts, and usually after the initial design stage, I have found it more efficient just to build and launch my app to view the actual working QML UI.
This worked for me:
I right-clicked my project, and selected in the drop-down menu:
Index > Re-resolve Unresolved Includes
Index > Rebuild
(Using Momentics 2.1.1)

Eclipse Blackberry Preprocessor Not Working?

I've already followed the directions # Using preprocessor directives in BlackBerry JDE plugin for eclipse? for making sure the blackberry plugin preprocessing hook is (theoretically) enabled.
I'm using Eclipse 3.5.1 with Blackberry Plugin 1.1 with BB SDKs 4.7.0 and 4.6.0.
I have my preprocessor defines set (and I've tried in both the Project's Blackberry Properties as well as the Workspace Blackberry Build settings), and checked their capitalization and spelling carefully too.
I'm fairly confident the actual code to say "this stuff should be preprocessed" is good, because including/excluding preprocessed code seems to work fine on command line builds:
//#preprocess --- at beginning of file
and then code blocks like this throughout:
//#ifndef jde_4_7
/*
//#endif
//#ifdef jde_4_7
import net.rim.device.api.ui.TouchEvent;
//#endif
//#ifndef jde_4_7
*/
//#endif
So what I can't figure out what else could be wrong that would cause Eclipse to not compile in my preprocessed code unless I remove the comments that are supposed to prevent the touch code from building into a build for blackberries that don't support touch.
At one point it used to work (and no I haven't updated Eclipse), but sometime in the last couple of weeks it seemed to just stop working. And I'm getting kind of tired of the error-prone process of searching for ifdefs and manually commenting/uncommenting touch code and looking for a better solution while I do testing and initial development requiring testing both touch and non-touch functionality.
Any other ideas on what could be wrong or how to fix it?
I managed to get this working by adding this in the eclipse ini file
osgi.framework.extensions=net.rim.ejde.preprocessing.hook
you would probably already have osgi.framework.extensions. Just add net.rim.ejde.preprocessing.hook to it.
Yeah, I've had the same experience with this. Seems like they've dropped support for it with their new plug-in. Sometimes it feels like those guys can't get anything right. If you want preprocessing I'm afraid you'll have to use Eclipse 3.4 and the old plug-in (1.0.67). You can go here and fetch a bundled eclipse 3.4 with the said plug-in and any other component pack you may need.