PhoneProductId in appxmanifest: Upgrade from Silverlight to Runtime vs. Map Service Application Id (wp RT 8.1) - silverlight

I'm updating an app from Windows Phone Silverlight 8.1 to WP Runtime 8.1 and got an issue with the "PhoneProductId" in the Package.appxmanifest:
1) Either I provide the Id from the old Silverlight version of the app. Then I can update it in the console via "AppDeployCmd.exe" /targetdevice:de /update MyApp_1.2.3.4_AnyCPU.appxbundle" with no user data being lost. But when I run MapRouteFinder.GetDrivingRouteAsync(...) I get an InvalidCredentials-error, since I haven't provided the proper Map Service Application Id, which in RT needs to replace the PhoneProductId (in Silverlight, it needed to be provided via c#, alongside the Authentication Token).
2) Or I provide the Map Service Application Id and can use MapRouteFinder.GetDrivingRouteAsync properly. But then I can neither /update the app (error message "Application is not installed" in the console) because of different PhoneProductIds in the two app versions. I also can't /install it without first uninstalling it ("Could not register package").
Anybody got a way out of this dilemma?

I've now uploaded soulution number 2 to the store, with GetDrivingRouteAsync working before the upload. The update did work, without any user data being lost, so no problem here.
However, when using the version from the store, GetDrivingRouteAsync is again not working (same problem as in solution number 1).
Seems to be exactly the same issue as this one:
https://stackoverflow.com/questions/32891052/invalid-credentials-with-getdrivingrouteasync-only-when-i-create-packages-for-st

Related

Accessing Local Settings in Windows 10

I am developing a Line-of-Business app for a client. The client specified the devices that were supposed to be used (some Dell tablet with Windows 8.1). Now, that the development is almost done and we were ready to release the first phase of the application, the client informed us that they have changed their mind and all those Dell tablets will run windows 10. I upgraded one tablet that I used for development and testing to Windows 10 as well. The tablet uses a RESTful Web API to access data stored in a repository. Obviously, the URL of the Web API must be configured in the settings of the app before the app can retrieve any data from the repository.
So I create the App Package to sideload the app on the tablet. The installation works properly, the app starts well for the first time. I go into the settings, set the URL and close the app.
When I try to restart, the app gets stuck showing the Splash Screen. If I try to access the Settings, I am informed that the settings for my app are not available at that time. The only way to get out of this is to uninstall the app and reinstall it again.
This is the code I use to save and retrieve the settings:
public void SaveSetting<T>(string settingName, T value)
{
ApplicationData.Current.LocalSettings.Values[settingName] = value;
}
public T GetSetting<T>(string settingName)
{
var localSettings = ApplicationData.Current.LocalSettings.Values;
if (localSettings.ContainsKey(settingName))
{
var value = localSettings[settingName];
if (value is T)
{
return (T)value;
}
}
// else, in all other cases
return default(T);
}
An interesting thing I noticed is that sometimes, depending on what I try to save in the settings, the app starts. For example, I was playing with it and tried to save some garbage instead of the correct URL. So instead of "http://x.x.x.x:nnnnn" I saved "a". The app started correctly, I got past the splash screen but obviously, I couldn't get any data.
Any ideas as to what exactly is happening? Did the access method for local settings change in Windows 10?
I have been scratching my head over this for the past couple of days. Initially, I thought it is a matter of permissions to create the Local Settings file, so I dedicated a lot of energy trying to find a solution from that perspective. However, as I said, if I dump some garbage in the settings, it works, so it's not a matter of permissions. Could it be that and IP address like "x.x.x.x" needs to be saved in a different way than as a string?
Any advice would be highly appreciated.
TIA,
Eddie
After I added some logging to my application I was able to prove that the app had no issues reading the settings. It's what it tried to do with them that it did not work. The URL read from the settings was correct but when the app tried to make calls to the Web API, the calls threw an exception and the app stopped working. So this shouldn't have been a question in the first place.
Thanks, Eddie

Trying to code sign Mac app with Developer ID - get com.apple.developer.maps entitlement is not allowed (error code -67050)

I am code signing a Mac app using my Developer ID certificate so we can send it to beta testers. Thanks to helpful articles here I made sure I have the right certificate and private key. (This is a new app id) When I select Developer ID and Archive, I select to distribute with Developer ID and it validates all the checks successfully (Using Xcode 6.1) and creates my app file. When I launch it I crash with this in console (another great tip found here to check console for the REAL error):
killed com.[appname.OSX][pid 5946] because its use of the com.apple.developer.maps entitlement is not allowed (error code -67050)
11/7/14 11:26:23.263 com.apple.xpc.launchd[1]: (com.VIPorbit.OSX.192016[5946]) Binary is improperly signed.
So, I know the docs say you cannot distribute an app with Maps outside of the MacApp Store, but I assume this mean selling Mac apps as is often done. We are using the Mac App Store all the way. Also I can successfully archive and submit to the Mac App Store and we're in review.
The challenge is we want to get this out to some beta folks and Maps is a key feature we've added. I really don't want to go the old route with getting this Mac info and adding it to the provisioning file, defeats the purpose of the Developer ID option.
Anyone else experience this?
You can't distribute an application utilizing MapKit with a Developer ID.
MapKit is an Mac App Store-only feature.
It's a shame that this is not clear from the documentation.
If you want to test the app before the Mac App Store submission, I am afraid you have to add beta-testers' machines to the provisioning profile and sign the bundle with a "Mac Developer: ..." code signing identity.
😔

SDK 3.1: How to tell whether SDK is using iOS6 accounts or not?

If I have a Facebook account set up in iOS6 but the user has switched it off, the SDK just gives me a FBSessionStateClosedLoginFailed status. From that, I can't tell if the user has switched us off in iOS (case 1) or doesn't have an account set up in iOS and declined permission from the FB app or web app (case 2).
The error messages I need to present are quite different in the two cases. In the first case, we need to tell the user how to switch us back on, but those instructions would be confusing for someone in case 2.
I tried using the iOS Accounts framework, but if I'm switched off, I'm told there ARE no Facebook accounts even if there are. I also tried writing down the account identifier if I ever successfully authenticate, but accountWithIdentifier fails similarly if we are switched off.
Anybody know of a way to find out if our rejection is coming from iOS or FB itself?
The policy of the SDK in general is that if some operation is in the process of failing, the underlying error information from the OS is bubbled up to the app. (Of course not all failure cases start with an OS API failing.) The reason for this policy is to support more precise error handling and logging scenarios like the one that you describe. As an aside, if you ever find a place in the SDK that does not follow this pattern, it is a bug and please report it.
In this case FBSession is passing an NSError object to your handler, and it sets the FBErrorInnerErrorKey value in the userInfo to the error object returned by the OS. In order to provide a precise error message to your user, you can use a snippet of code like this in your FBSessionStateClosedLoginFailed case:
if (error) {
NSError *innerError = error.userInfo[FBErrorInnerErrorKey];
if ([innerError.domain isEqualToString:ACErrorDomain] &&
innerError.code == ACErrorPermissionDenied) {
NSLog(#"User dissallowed permissions via iOS 6.0 integration");
}
}
Hope this helps!
* UPDATE *
Just tried this on a device and found two bugs; one in iOS 6.0, and the other in the SDK. The iOS 6.0 bug is that when the switch is off, no NSError object is passed by the OS, and so there is no inner error. Thus making the general solution from above not work for the specific case in question. The second bug does provide you a temporary solution to this problem using the SDK 3.1.1.
The bug in the SDK 3.1.1 is that we set error.userInfo[FBErrorLoginFailedReason] to the value of FBErrorLoginFailedReason. In the case where the inner error is NIL, you can check for this reason value to determine that the slider for the app was set to off. When this bug is fixed in the SDK, then the code testing for this will break, however, since we will be setting the reason to a more logical reason related to iOS 6. This is a gotcha to watch out for in a future build of your application, if you decide to rely on this value.
With iOS 6.0 and later, when you access setting device and turn off facebook integration in your app. You can check it by code
//Callback method for facebook authorization
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
.....
if (error) {
NSString *valueError = [error.userInfo objectForKey:FBErrorLoginFailedReason];
if ([valueError compare:FBErrorLoginFailedReasonSystemDisallowedWithoutErrorValue] == NSOrderedSame)
NSLog(#"To use your Facebook account with this app, open Settings > Facebook and make sure this app is turned on.");
}
}
If the login fails you could try opening the old webview facebook login dialog which iOS cannot reject. If that succeeds then they don't have iOS 6 or they switched you off in iOS 6 which I didn't know was possible.

Silverlight webapplication white screen of death

I'm having an white screen of death when trying to debug my silverlight application. The problem is that I don't know what causes it and I don't get any type of information from either Visual Studio or the browser itself (IE9). Breakpoints won't be hit as App() in the App.xml.cs doesn't get fired either.
The application works fine on my own laptop, but I'm trying to make final adjustments to it on the server which will host the application once it's done. The problem occures on this server.
Would there be any way to get information about what's causing it or did someone experience simulair issues?
hit F12 in IE and go to network and start capturing. You should see your error there if something went wrong downloading and also if there was a problem with the Silverlight plugin (check Console or Script tag).
There could be a number of reasons for this including problems with database connectivity, WCF services, and many other factors. One thing that might help you get some information is a product called Fiddler. If you are able to download and install that on your development machine, you can have it running when you try and access your application on the server. It will give you messages for every step of your application initialization, including database authentication, service authentication, the xap file transfer, etc.
My problem was related to init params not loading up from the web project's .aspx page, try having a look at this if you are having "white death screen" issues.

Silverlight web service call not even hitting servers

I have a custom proxy class for a single WCF web-service (takes a string in, sends a string back). The asynchronous web service call works great from my Windows Form app. However, when I call it from a test Silverlight app I get an error: Hresult 0x80000012. This error is for Extension Attributes on files I believe... Go figure.
Using Fiddler I can confirm that no traffic is making it to IIS which is hosting the service, so it isn't the usual cross-domain restriction issue. I've tried using both "localhost" (which works in the Windows Forms app) and a name defined in my hosts file just in case "localhost" was causing the problem.
I've tested it by making the async call from the UI thread and also from a thread-pool queue item with the same results.
The proxy code is basically just simplified down from what the MS proxy generator creates, setting up bindings and settings programatically instead of via config files, and I use basically the same source to compile normal .Net and Silverlight versions of the libraries involved. (Now, the MS proxy code it is based on is from a WCF web service, not from the RIA template code, so maybe there are differences there...)
Four days of fruitless search on this one. Any help or suggestions would be wildly appreciated!
Figured it out. I was using (stupidly) a backslash in part of the URL that I used to set up the service call. Most of the interior parts of the MS code handled that ok and transposed them to forward slashes -- on Windows Forms everything worked seamlessly in fact. However, the Silverlight libraries couldn't handle it and threw the very helpful "HResult 0x80000012" error.
Changing my backslashes to slashes seems to have fixed the problem!

Resources