Outlets are null in ViewDidLoad with mvvmcross - iphone

In my view.designer.cs my outlets are generated by xcode.
When starting debug I have a null reference exception on my properties when adding bindings, in the code bellow this.SampleText is null.
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
this.AddBindings(
new Dictionary<object, string>()
{
{ this.SampleText, "{'Text':{'Path':'VMText'}}"}
});
}
I noticed the following error in Application's output :
"Application windows are expected to have a root view controller at the end of application launch"
what did I miss ?

It sounds like you might have a more general problem with your iOS setup - possibly some issues with the XIB file synchronisation between xcode and MonoTouch.
Before you try to add the MvvmCross binding take a look at the MonoTouch layer - if this.SampleText is null in the MonoTouch layer then you need to solve that before you can add the MvvmCross binding code.
The MonoTouch soft debugger is an excellent tool to help debug this - and the debug cycle with the simulator is pretty quick - so this often helps solve these problems.
From your partial answer to this question, it does sounds like you were trying to use a XIB in a Dialog based UI - that's probably not going to work - I think MonoTouch.Dialog is always based on a single Table - so it's not expecting a XIB (at least, that's my experience!)
As for "Application windows are expected to have a root view controller at the end of application launch" that sounds more like a general problem in your AppDelegate.cs perhaps. Alternatively it might be a problem in the presenter. Which presenter are you using?
That error message itself has a lot of hits on StackOverflow - e.g. Applications are expected to have a root view controller at the end of application launch - but I'm not sure which of these is appropriate to your case right now.
I must admit everything is not clear for me with iOS and MVVMCross
For coders coming from a C# background I don't think this is unusual - I think the jump from VS on Windows to MonoDevelop on Mac (with a little xcode) is a non-trivial leap. It takes more time to switch from WP to iOS development than it does from WP to Droid - this is the case independent of whether you use MvvmCross - if you are doing MT development you are doing native code, so you do have to take some time to understand iOS a bit (in my experience/opinion!).
For the most part, I've personally written tens of thousands of lines of code, authored hundreds of blog posts and stackoverflow answers, and presented maybe ten sessions on mvvmcross. I've done this across five distinct operating systems, four of which I've learnt as I've coded and all of which I've battled against platform and tooling bugs and idiosyncrasies.
I'll continue to post as much as I can - and continue to operate for 'free'
I do also encourage every user to post and blog about their experience too. In this way I hope knowledge will be generated and shared. To anyone who is reading this, using mvvmcross and learning something about cross platform coding - good or bad - then please do consider sharing that knowledge. For inspiration, check out some of the presentations and blog posts users have written - I try to list them on http://slodge.blogspot.co.uk/p/mvvmcross-quicklist.html. Thanks :)
Also, when asking questions, please can you indicate which version of mvvmcross you are using and which sample(s) you're basing your code on - there are differences between master and vNext and there have been fixes over time - so posting this info will help me try to understand and/or replicate the errors you are seeing.
Thanks :)

I know this is a little old, but I was just having the same issue.
My outlet properties in my View.designer.cs file were null when I attempted to access them when ViewDidLoad was called.
Turned out that my xib file in Visual Studio was no longer set to a Build Action of InterfaceDefinition.
Hopefully, this helps someone else who stumbles upon this issue.

Related

OS11 replacement for RadioInfo?

Is there a replacement for the RadioInfo that was removed as of OS11? (com.android.settings/.RadioInfo)
If not, where else can this information be found in UI? Or adb? (preferably without rooting the device)
Our team relies heavily on the use of the data in RadioInfo for QA testing, especially since it works on nearly all Android devices (rather than being OEM-dependent like engineering short codes).
It also offered ideal granularity in network selection, moreso than the basic Settings UI.
Also, why was it removed? I looked back about 11 months in logs and didn't see a single mention of it (though maybe I'm looking in the wrong place - if there's a comment on it somewhere, please do share the link).
Looks like it just got moved.
10 and earlier:
com.android.settings/.RadioInfo
as of 11:
com.android.phone/.settings.RadioInfo

Problems getting OSVR to initialise the HMD Display with Oculus DK2

I am using a Oculus DK2 (v0.8) and OSVR SDK. I'm having a problem getting the HMD to run/display anything.
The Oculus samples and the OSVR samples do work however, so the osvr_server seems to run fine.
My application itself renders a test scene just fine when not using a HMD.
I tried two approaches:
First, just creating a osvr context and creating a DisplayConfig object. This seems to work, but DisplayConfig::checkStartup() fails (I do this in a loop, calling update on the context when the checkStartup call is failing). I used the OpenGLSample.cpp as a guide for this
Second, I tried using a RenderManager, but the call to createRenderManager results in a crash within the RenderManager.dll. I get the same crash wether I create the graphics lib object myself or if I let the library create it.
I am quite stuck now, since the demos and examples do work, I have no idea where to look for the error on my side. Creating the context works, querying interfaces as well, but the crash with createRenderManager is beyond me.
Does anyone have any hints or ideas what the problem could possibly be?
Regards and thanks in advance
pettersson
RenderManager should not crash during open. There have been a couple of bug fixes recently to avoid that happening, and the latest RenderManager binaries, libraries and header files are available with the SDK download from http://osvr.github.io/using/ along with updated copies of the example programs.
When something goes wrong in RenderManager, it usually reports that to standard error. We're moving that to a logging interface, but for now it should show up on the console. Posting an output of that as an issue at https://github.com/sensics/OSVR-RenderManager/issues is a good way to let the developers know that there is a problem. Of course, providing the same sort of information you provided here will be helpful as well.

2 Simple questions related to xCode and Swift for someone new to Coding

Being new to coding I have a few newbie questions I'm hoping someone could confirm for me.
in xCode is the Playground just for testing code. Whatever I decide to actually be used needs to be copied to somewhere else to actually use it?
ViewController.swift - How do I decide what should go here or when to make a new "file"?
Yes, playgrounds are for playing with code and experimenting and getting immediate feedback without the usual build and run cycle. However, coding in them is slightly different to normal app programming. One thing you'll notice is that everything is top down, so you have to declare something above where it is used first, which you don't have to do in normal swift apps.
What you should put in ViewController.swift... such a broad question. You might be better off reading an iOS programming beginners book or guide, than asking that here. You should become familiar with MVC for what you put in a view controller. Potentially, you could put everything in ViewController.swift if you desired - but it wouldn't be very nice to work with. The only thing I would put in ViewController.swift, is the code for the ViewController class. I'd create a new file per class I create, new file for a protocol (most of the time), new file for defining constants usually. It's up to you, but at least a new file per class.

how can I improve iPhone UI Automation?

I was googling a lot in order to find a solution for my problems with UI Automation. I found a post that nice summarizes the issues:
There's no way to run tests from the command line.(...)
There's no way to set up or reset state. (...)
Part of the previous problem is that UI Automation has no concept of discrete tests. (...)
There's no way to programmatically retrieve the results of the test run. (...)
source: https://content.pivotal.io/blog/iphone-ui-automation-tests-a-decent-start
Problem no. 3 can be solved with jasmine (https://github.com/pivotal/jasmine-iphone)
How about other problems? Have there been any improvements introduced since that post (July 20, 2010)?
And one more problem: is it true that the only existing method for selecting a particular UI element is adding an accessibility label in the application source code?
While UI Automation has improved since that post was made, the improvements that I've seen have all been related to reliability rather than new functionality.
He brings up good points about some of the issues with using UI Automation for more serious testing. If you read the comments later on, there's a significant amount of discussion about ways to address these issues.
The topic of running tests from the command line is discussed in this question, where a potential solution is hinted at in the Apple Developer Forums. I've not tried this myself.
You can export the results of a test after it is run, which you could parse offline.
Finally, in regards to your last question, you can address UI elements without assigning them an accessibility label. Many common UIKit controls are accessible by default, so you can already target them by name. Otherwise, you can pick out views from their location in the display hierarchy, like in the following example:
var tableView = mainWindow.tableViews()[0];
As always, if there's something missing from the UI Automation tool that is important to you, file an enhancement request so that it might find its way into the next version of the SDK.
Have you tried IMAT? https://code.intuit.com/sf/sfmain/do/viewProject/projects.ginsu . It uses the native javascript sdk that Apple provides and can be triggered via command line or Instruments.
In response to each of your questions:
There's no way to run tests from the command line.(...)
Apple now provides this. With IMAT, you can kick off tests via command line or via Instruments. Before Apple provided the command line interface, we were using AppleScript to bring up Instruments and then kick off the tests - nasty.
There's no way to set up or reset state. (...)
Check out this state diagram: https://code.intuit.com/sf/wiki/do/viewPage/projects.ginsu/wiki/RecoveringFromTestFailures
Part of the previous problem is that UI Automation has no concept of discrete tests. (...)
Agreed. Both IMAT and tuneup.js (https://github.com/alexvollmer/tuneup_js#readme) allow for this.
There's no way to programmatically retrieve the results of the test run. (...)
Reading the trailing plist file is not trivial. IMAT provides a jUnit like report after a test run by reading the plist file and this is picked up by my CI Tool (Teamcity, Jenkins, CruiseControl)
Check out http://lemonjar.com/blog/?p=69
It talks about how to run UIA from the command line
Try to check the element hierarchy, the table can be placed over a UIScrollView.
var tableV = mainWindowTarget.scrollViews()[0].tableViews()[0].scrollToElementWithName("Name of element inside the cell");
the above script will work even the element is in 12th cell(but the name should be exactly the same as mentioned inside the cell)

Making multiple versions of an iPhone application

I made an iPhone application, and now I would like to make multiple more versions of the same application with very slightly different functionality.
I was wondering if anyone knew what the best way was to go about duplicating a project with as little decoupling (I think that's the right term) as possible.
Maybe someone out there who has made a LITE version of their iPhone application? How they went about doing it and what lessons they learned from it?
Shoot, I'm sorry. Didn't find this when I was searching earlier, but looks like a lot of what I am looking for has already been answered here: How do I manage building a Lite vs Paid version of an iPhone app?
One low budget, low overhead approach that I've used that will keep things simple is as follows:
/******************************************
* Set to 'FREE_APP' or 'PAID_APP'
******************************************/
#define PAID_APP
Within your application, you then write code simimar to the following:
#ifdef PAID_APP
#interface myViewController : UITableViewController
#else
#interface myViewController : UITableViewController <CustomTableAppDelegate>
#endif
This is by no means the best all around approach as you still have update the info.plist file to set the executable name and bundle identifier. However, in a pinch, it works well to maintain one code base/project.
Here's another link
I've used this approach and it works pretty well.