We've been using the latest version (unified API) of the iOS Google Maps component from xamarin in our app with great success. We of course have the proper API key in place and can render maps all day with custom markers and other features.
Our problem is that when the app "sometimes" comes back from being in the background (home button pressed), the map no longer draws any data on it. The map is blank but the Google logo is still in the bottom left corner so I know the control hasn't been unloaded. Once in this blank map state we have to kill the app and restart it to start getting map data drawn again. There are no exceptions thrown and no errors in the iOS logs. I have done a lot of research and this issue also presents it self when the maps do not have a proper API key but that clearly isn't our scenario unless somehow the maps component is losing that API key connection?
what could be the cause of this and how can we fix it Please? can we pay for support from xamarin for this issue if there is no 'quick fix'?
Here is the screenshot of the issue:
No worry I also had the same problem when I'm working with this Component
try not to save API Key on any constants. Directly pass the value. If it is not working try regenerating the API Key. Map should
I thing currently you are following this code pattern like how they provide
using Google.Maps;
...
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
const string MapsApiKey = "<Get your ID at https://code.google.com/apis/console/>";
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
MapServices.ProvideAPIKey (MapsApiKey);
...
}
}
Instead of this code you can directly pass the API Key like below or you might be forgot to remove the angle brackets.
MapServices.ProvideAPIKey ("AIzaSyAnxfhuAwEqdVhQpoUkGFZpsBukOSXVFr0");
Happy coding:)
Related
Problems
I'm using react-native for our current services, and we are sending cookies to our webpage to send information which is needed to seen in our webview. These process is working PERFECTLY in android devices, but not in IOS. (The most annoying thing is set-cookie works sometimes in IOS in same condition. It just randomly succeeded, and I cannot find the reason why.)
How To Reprouce
First of all, these are the stacks we are currently using.
Application: React-Native
Webview: react-native-webview (https://github.com/react-native-webview/react-native-webview)
Cookie: #react-native-cookies/cookies (https://github.com/react-native-cookies/cookies)
Webpage: React (Already deployed in AWS)
Cookie: react-cookie (useCookie)
And the following is our process we are currently doing.
If the user clicks a button (I will call this button as 'Apply' button), it navigates to screen that includes <WebView />
This is a abstract of our webview screen code (For our security issue, I just abstracted and changed some code for it, so if you think more information for our code, please let me know.)
Rendering Page
enter image description here
WebView Component
enter image description here
Send Cookie
enter image description here
Send Cookie Function
enter image description here
(This function is kinda messy bc this is a collective code from 3 files, and I tried my best to set cookie differently with android. (The same logic with android doesn't work in IOS))
Webpage (Launched in AWS)
enter image description here
I Want My Code To Do This
I want my code to send cookie in loading state, and after loading, when the webview rendered, the webpage get some cookie and based on that cookie, it shows some data.
It PERFECTLY works on Android, but not in IOS. It works randomly in IOS so I have no idea what the heck is wrong with this code and hard to define a problem.
I tried...
Someone said to me to add '.' infront of domain. It worked for the very first time, but after the second trial, it starts to not working again
I also tried clear all cookie data before set cookie using
await CookieManager.clearAll();
, but it works same as the first measure I tried.
I also tried to use webkit. I send all true arguments to use webkit while using cookiemanager, but it has no effect.
I expected to do...
As I write in the above, I hope the cookie is rightly set in both android and ios environment, perfectly works in both platform.
I'm writing a web app for Tizen Smart TV. One of the required features is implementing the Smarthub Public Preview deeplinking.
I have setup the app to open at a specific content when the Public preview tile is clicked. However, I cannot prevent the app to reload. The documentation mentions adding the appcontrol event to the window event listeners, but I don't think this event is being recognized by the app, since the code is not executed.
It only works if I directly add my deeplink() method to the onload property.
According to documentation, this piece of code should prevent the app to reload, but it is not working:
<tizen:app-control>
<tizen:src name='index.html' reload='disable'></tizen:src>
<tizen:operation name='http://samsung.com/appcontrol/operation/eden_resume'></tizen:operation>
</tizen:app-control>
window eventListener is not working wither:
onload="window.addEventListener('appcontrol', deepLink)"
Any help on how to implement this correctly?
Thank you in advance
You are probably modyfing window.location in the app (ie in router).
reload='disable' prevents reloading index.html. When application receives app control request and page is different, application will be reloaded.
You can find more about appcontrol in Tizen documentation (note that Tizen for TV may differ from other devices):
https://docs.tizen.org/application/web/guides/app-management/app-controls/
I've got some information regarding your question.
To do application resume without Page reload,
Set extra data in app-control like below
key: SkipReload
value: Yes
I have a Xamarin.iOS application where I am using this guide to make use of the CMPedometer floors ascended property. Here is some relevant code on my single view app:
CMPedometer pedometer;
...
public override async void ViewDidLoad(){
base.ViewDidLoad();
if (CMPedometer.IsFloorCountingAvailable)
{
pedometer = new CMPedometer();
//app crashes here:
pedometer.StartPedometerUpdates(new NSDate(), UpdatePedometerData);
var data = await pedometer.QueryPedometerDataAsync((NSDate)DateTime.SpecifyKind(DateTime.Now.AddHours(-24), DateTimeKind.Utc), (NSDate)DateTime.Now);
UpdatePedometerData(data, null);
}
}
My very basic app crashes when I try to get updates from my CMPedometer with little error output. This is what I get:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
which may be an issue with my app permissions? If that's the case I am not sure how to grant/ask permissions on using the CDPedometer. Thanks for any help
Got this link. You have to add privacy setting for motion in your plist
https://blog.xamarin.com/new-ios-10-privacy-permission-settings/
Thanks to #panthor314 for getting me pointed in the right direction. Unfortunately the blog link above is dead, but this seems to be the new location for this information:
https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/security-privacy?tabs=windows
This link explains:
Apps that fail to provide the required keys will be silently terminated by the system when they attempt to access one of the restricted features or user information, without error! If an app starts unexpectedly failing on iOS 10, ensure that all of the required Info.plist have been specified.
The relevant privacy key is NSMotionUsageDescription:
Motion Usage Description (NSMotionUsageDescription) - Allows the developer to describe why the app wants to access the device's accelerometer.
To add the property:
Right-click on Info.plist in your Solution Explorer (double click seems to open a different window)
Select Open With...
Select Generic PList Editor and click OK
At the end of the plist, click the + icon to add a new entry
Change Custom Property to Privacy - Motion Usage Description
Enter text to display to the user about accessing steps such as "This application would like to access your steps data"
Save the file and run the application again
I'm a newbie iOS programmer and I'm having problems using google's Api "directions" for (multipath/multiroute) on iOS (8.x):
when i ask to draw a route between two location (origin/destination) there aren't any problems but if i add even one more location, the request to web service return a json with no elements.
My url (for the request) is something like this:
https://maps.googleapis.com/maps/api/directions/json?origin=40.853900,14.246600&destination=45.120000,12.535900&waypoints=optimize:true%7C41.910000,12.535900&mode=driving&key=API_KEY
I have already enabled the API's (directions, static maps, google maps for iOS). The api key has been generated today and seems ok.
what am i doing wrong?
Your URL request works for me. I'm getting zero results because your destination coordinate is middle of the ocean.
Make sure your API key iOS key when testing on iOS device and browser key when testing on your browser.
When the icon of my Safari app extension icon is touched, I want to change the URL without showing a new view. Doing this comes down to two issues:
How can I use an safari app extension without showing a new view? I just want to perform a background action when the extension icon is pressed.
How can I change the current URL in Safari?
Actually, you might be able to change the URL at the finalize function of your ExtensionPreprocessingJS file
// Note that the finalize function is only available in iOS.
finalize: function(arguments) {
// arguments contains the value the extension provides in
[NSExtensionContext completeRequestReturningItems:completion:].
// In this example, the extension provides a color as a returning item.
document.URL = arguments["newUrl"];
}
It seems like what you're describing is a bookmark, and not an app extension. I would highly doubt that app extensions would allow you to interface with Safari and update the URL, this would be wrong in many regards, including privacy and security. In short, not possible (sorry).