Xamarin - web service call works on simulator, not on iPhone - xamarin

I've never come across this, I have a web service call that's working on the iOS simulator just fine, but when I try to debug the same on my iPhone (7plus - 10.3.1), the application crashes and I get this very strange error. This is the call causing the the crash (I'm trying to format this as code, but it's not working at all):
var cancellationToken = new CancellationToken();
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
 
var responseMessage = await httpClient.PostAsync(path, content, cancellationToken);
// CRASH OCCURS ON THE NEXT LINE
return await responseMessage.Content.ReadAsAsync<TokenResponse>(cancellationToken);
Here is the error:
System.ExecutionEngineException: Attempting to JIT compile method 'System.Net.Http.HttpContentExtensions:ReadAsAsync (System.Net.Http.HttpContent,System.Type,System.Collections.Generic.IEnumerable`1,System.Net.Http.Formatting.IFormatterLogger,System.Threading.CancellationToken)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
I don't appear to be doing anything that limitations link is describing and again it's working just fine on both the iOS simulator and Android simulator as well as my Android device. Any idea how to proceed? I can post more code if needed.

Related

Xamarin iOS api call fails suddenly when app goes to background or notification panel drawn

In Xamarin iOS , when the api call starts requesting, when we switch app to background or the notification panel is drawn from the top, suddenly api call fails. Api returns bad request.No issues with foreground calls. This does not happen in android. api calls will be successful in background. When DidEnterBackground method has hit, api call will be failed by the time.I am using iOS OS 13.6 device. Forms has the latest version.Please help...
In the iOS build settings,Changing the HttpClient Implementation option from NSUrlSession to Managed fixed the issue!!!

XAMARIN IOS APP Closes automatically on launching with no crash report

The ios app was working fine and I was working and debugging on the simulator, suddenly the app starts and closes, no crash report. The app closes after loading the assembly as per what I can see from the application output log with no crash report. Even the debugger detaches and stopped debugging and comes to it default play state.
Lastly I also see the this error " The call is ambiguous between the calling methods App.InitializeComponent() and App.InitializeComponent(). Basically for all Xaml Pages.
I tried reinstalling all the packages and updating for all Packages(shared/ios/android) but still issue persist.
Screenshot of the package installed.

Google Sign-In for iOS using Xamarin throws exception logs point to podfile

Trying to implement the Google Sign-In for IOS in a Xamarin project. Right on the Google page where it generates your GoogleService-Info.plist file, it says, "Insure you have CocoaPods installed and configured for your project. In you Podfile, include the following: pod 'Google/SignIn'".
And sure enough, the log on the Mac shows a similar error when going through the initial configuration.
But, I can't find anything that really tells me how to add a "Podfile" to a Xamarin IOS project (from within Visual Studio 2017, running on Windows 10).
So, when it comes time to actually click the Sign-In with Google button, in an IOS 10.3 IPhone 6 simulator, it throws an exception,
"Foundation.MonoTouchException: Objective-C exception thrown. Name:
NSInvalidArgumentException Reason: -[__NSCFString
countByEnumeratingWithState:objects:count:]: unrecognized selector
sent to instance 0x608000047200".
I can only hope it is really because of a missing component that the Podfile is supposed to resolve.
Saw a sample from a year ago that supposedly worked, but with what seems to be current right now, I can't get it to.
Update:
The sample I am trying to use, creates a custom class for the View so it can implement a custom Renderer, and a custom class for the page, again, so it can implement a custom Renderer. The View Renderer simply does:
signInButton = new SignInButton();
signInButton.Style = ButtonStyle.Wide;
signInButton.ColorScheme = ButtonColorScheme.Dark;
SetNativeControl(signInButton);
The Google button shows up, but when you click, you get the exception listed above.
A recent update to Xamarin required an update to XCode. With the update to XCode 9,the problem went away, and Google authorization is working.

iOS application launch after updating to Xcode 5.1.1

I upgraded my mac OS to mavericks and also my Xcode 4.6 to Xcode 5.1.1.
I tried to launch my iOS app which was originally built on iOS 6 in the iOS 7.1 simulator.
I get the login page as intended but as soon as the login page is displayed I get an error in the main method exactly at the below line and the execution stops there. The description says "signal SIGKILL". I am not able to figure out a fix for this as all the app delegates call back methods are called fine and there seems to be no issues with the application code. Can anyone please let me know what could be the problem here.
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CommVotesAppDelegate class]));

Cordova window.openDatabase() on Xcode - no error output

I have a Cordova iOS app that makes a call to window.openDatabase() in the onDeviceReady() event handler. It seems execution of the onDeviceReady() event handler stops on that line, because my console.log() beneath that line never show up in the debug console in Xcode. Neither do any other error messages.
The same code works fine on Android devices and Chrome/Ripple emulator. What is wrong?
var db = null;
// PhoneGap is ready
function onDeviceReady() {
console.log("onDeviceReady");
db = window.openDatabase("mydb", "1.0", "My DB", 100000000);
console.log("This will never be displayed in Xcode log");
db.transaction(checkDB, checkErrorCB);
}
Cordova version: 2.3.0
Xcode version: 4.5.2
I am testing on iPhone 5.1 and iPhone 6.0 simulator.
Doh!!
Seems the DB size I specified was to big, it all started working when I removed a zero... That's the kind of thing that's easy to overlook when you've been looking at the same code for weeks and it's been working fine. I just picked a random large number "to be on the safe side".
This code is working:
db = window.openDatabase("mydb", "1.0", "My DB", 10000000);

Resources