Windows Phone 8 JSON - json

I am starting the development on windows phone 8, the famous JSON.NET does not support windows phone 8 yet, is there any other library which can be used for this purpose?

The JSON.NET codeplex site says that WP8 is supported.
Update: The JSON.NET NuGet package should just work with a Windows Phone 8.0 project. Adding it in VS2012 NuGet manager pulls in the WP7 version of JSON.NET. (packages\Newtonsoft.Json.4.5.10\lib\sl3-wp\Newtonsoft.Json.dll)
JSON.NET is now also available as a Portable Class Library which you can consume from WP8 (available in NuGet or in source form).

Had the exact same problem - turns out I didn't have the newest version of NuGet.
To upgrade, click tools -> extensions and updates and then click the Updates-tab. Update everything, restart the program and try again. :-)

I was having this issue. I was able to compile the source for Windows Phone 8 instead of Windows 7.1 and it worked. NuGet would not work for me.
Here is how I did it:
Open up solution JsonXXrXX.zip\Source\Src\Newtonsoft.JSON.WindowsPhone.sln
Go to properties for Newtonsoft.Json.WindowsPhone Project(Right click on the project then properties)
For the dropdown of "Target Windows Phone OS Version" select Windows 8.X
Compile.
Grab the DLL, PDB, and XML from the output directory
Add Reference to the DLL file in your Windows Phone 8 Project
Thats it. I can't vouch that it works 100% or that you'll be able to submit your app. But it should hold you over until there is official support.

For complex json you might find this website helpful: http://json2csharp.com/#.

If you don't wanna make too fancy stuff (or need dictionary) suppport, you can also just use the built-in DataContractJsonSerializer (http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx)
Btw: At least in https://json.codeplex.com/discussions/401305 some people report that the WP7.1 dll works for them, using this file: "Newtonsoft.Json.4.5.7\lib\sl4-windowsphone71\Newtonsoft.Json.dll".

Related

Autofac.Mef and WinRT

I'm having troubles while trying to add the Metadata of Autofac. I have to install the package "Autofac Extras: Metadata Attribute Support" which need Autofac.Mef. When installing this package, I get a message saying that I try to install Autofac.Mef 4.0.0 in a project targeting «portable-net45+win+wpa81» and that the package doesn't contain any file supporting this. (Same message with Autofac.Mef 3.0.3).
I could probably find a way to make my project work without Autofac's Metadata but I don't understand why this package isn't compatible with Windows Phone 8.1. Is there a solution to this issue?
Thanks in advance
Thomas
If you download the Autofac.Mef package manually and then open it up in NuGet Package Explorer you'll see that the Autofac.Mef package only targets .NET 4.5 apps - you can't use it in Windows Phone.
The reason for this is that the original framework MEF is only compatible with the full .NET framework. There's a "lighter weight" MEF 2 framework that is compatible with Windows Phone 8.1 but that's not the one Autofac.Mef works with.
There's no way to fix it. There's also no current plan to switch Autofac.Mef to using the Microsoft.Composition package.

Windows Phone 8.1 HubApp + HtmlAgilityPack

I know that using HAP in windows phone apps is very problematic, but I very need to. So the problem is that when I add System.Xml.XPath from silverlight 5 or 4 I get "Xaml Internal Error error WMC9999". It's got to be noticed that the version of HAP is 1.4.6 but not 1.4.9 (tha latest one), because it cannot be installed from NuGet (just doesn't add reference) and I've found no links to download it manually.
In old windows phone 8 silverlight app everything worked great.
Please, help.
Use the HtmlAgilityPack-PCL nuget package with Windows Phone 8.1 XAML apps, it works fine with no need to add any references manually.

Parse.com for Windows Phone 8 - get_LocalSettings() not implemented

I am using Parse.com storage service for Windows Phone 8. When I try to initialize
ParseClient.Initialize("MY_APP_ID","MY_NET_ID");
I am getting this exception:
System.NotImplementedException: The method or operation is not implemented.
at Windows.Storage.ApplicationData.get_LocalSettings()
at Parse.PlatformHooks.SettingsWrapper..ctor()
at Parse.PlatformHooks.SettingsWrapper.get_Wrapper()
at Parse....
I am targeting Windows Phone 8 and I found out that WP8 is not supporting LocalSettings, just WP8.1.
When I target it to WP8.1 everything is working fine.
But...
I have another application for WP8 in which I am using Parse and everything is working fine.
How can I avoid this problem?
Just for info: App which does not work was built for WP7.1 and than upgraded to WP8, and another which works fine was from beginnig targeting WP8.
Thanks
I found the solution. If someone has the same problem, just install older version of parse package in Nuget.
PM> unInstall-Package parse
PM> Install-Package parse -Version 1.2.16

Compile Windows DLL for WP8

I've got the c# source for a DLL that works on windows 8... I would like to use it in a windows phone 8 application. Is there an easy way to change the target platform of the project to WP8 and then compile for that? I assume it will have to be compiled as a Windows Phone Class Library but that should be fine. I'm using VS2013.
Well it depends on the library. If it has any dependencies to the full .net framework, it will most likely not work. If its just a generic Library, you should be able to make a new Windows Phone Class Library Project and copy over the source.
I guess, you'd simply have to try that. Maybe you can bypass some of the dependencies and rewrite these sections with Windows Phone compatible code.

Windows phone emulator doesn't work

I was just testing Unity 4.2's new feature - Windows Phone deployment, but it doesn't seem to work.
Is there any way to get it running on an emulator rather than on a physical device?
Thanks
EDIT:
I tried changing configuration to "x86" but It's now giving me another error:
I think I attempted all possible combinations, but it still doesn't work:
You are trying to deploy an ARM native binary to an x86 "phone". You will need to compile your project for the x86 CPU architecture for it to work on the emulator.
Make sure that you change your "Solution Platforms" from "AnyCPU", "Mixed Platforms" or "ARM" to "x86" and re-build your project.
You should find that the "Debug Target" switches automatically from "Device" to "Emulator WVGA 512MB" once you change the Solution Platform.
You may have to unhide the option to switch between CPU architectures in in Visual Studio 2012. In the Standard Toolbar options make sure that the "Solution Platforms" control is visible in your toolbar.
It looks like the reference errors you are getting could mean that those classes aren't compatible with your architecture.
Please check the path. In the solution explorer if it is showing any missing files, fix them by adding existing items. It seems like you are missing dll files also.
Registered Windows Phone 8 device is needed to test your apps.
Instructions on phone registration can be found here. Windows Phone
Emulator will be supported in future Unity releases.
https://docs.unity3d.com/Documentation/Manual/wp8-gettingstarted.html
in my opinion you should check the localizedString first, after that set up your IP of Emulator