iOS WKWebView error: "localized string not found" - runtime-error

An application has been written using WKWebView.
Everything works fine on a test server. Moved the web part to the customer's server. Immediately when trying to load the first page, an error occurred in didFailProvisionalNavigation.
"didFailProvisionalNavigation", "Error Domain=WKErrorDomain Code=13 "localized string not found" UserInfo={_WKRecoveryAttempterErrorKey=<WKReloadFrameErrorRecoveryAttempter: 0x2807a4020>, NSErrorFailingURLStringKey=https://XXXXXX, NSErrorFailingURLKey=https://XXXXXX, NSLocalizedDescription=localized string not found}"
The application defines the localizations Base, English (en) and Russian (ru).
Everything works fine on the old server.
Old test server:
DB - Oracle 10.2.0.4
HTTP Server - OHS - 11
OS - WS2012R2
New broken server:
DB - Oracle 11.2.0.4
OHS - 12.1.3.0.0
OS - Windows Server 2008 R2 Enterprise
WKWebView settings:
let configuration = WKWebViewConfiguration()
configuration.preferences.javaScriptEnabled = true
configuration.preferences.javaScriptCanOpenWindowsAutomatically = true
configuration.ignoresViewportScaleLimits = false
configuration.allowsInlineMediaPlayback = true
if #available (iOS 14.0, *) {
configuration.defaultWebpagePreferences.allowsContentJavaScript = true
configuration.limitsNavigationsToAppBoundDomains = true
}
webView = WKWebView(frame: .zero, configuration: configuration)
pullControl.attributedTitle = NSMutableAttributedString(string: "Pull to update"). setColor(.black)
pullControl.addTarget (self, action: #selector(pullAction (_ :)), for: .valueChanged)
if #available (iOS 10.0, *) {
webView.scrollView.refreshControl = pullControl
} else {
webView.scrollView.addSubview (pullControl)
webView.scrollView.bounces = true
}
webView.customUserAgent = "XXXXX iOS application"
webView.allowsBackForwardNavigationGestures = true
webView.scrollView.bounces = true
webView.navigationDelegate = self
webView.uiDelegate = self
let urlRequest = URLRequest(url: URL (string: SITE_URL)!)
webView.load(urlRequest)

Related

Google cloud vision crashes on Image Annotator Client creation

I'm using google cloud vision to detect and extract text from images.
It was working fine but suddenly started to crash without any exceptions caught.
I could not reproduce this locally, only occurs on the staging environment (Amazon EC2)
I know this question was asked before but it was not answered properly.
public ImageAnnotatorClient getInstance() throws IOException {
try {
if (imageAnnotatorClient == null) {
log.info("creating Image Annotator Client ...");
log.info("creating ServiceAccountCredentials ...");
var credentialStream = new ByteArrayInputStream(
propertiesService.get("GOOGLE_VISION_SERVICE_ACCOUNT_CREDENTIAL").getBytes());
Credentials myCredentials = ServiceAccountCredentials.fromStream(credentialStream);
log.info("creating Image Annotator Settings ...");
ImageAnnotatorSettings imageAnnotatorSettings =
ImageAnnotatorSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
imageAnnotatorClient = ImageAnnotatorClient.create(imageAnnotatorSettings);
log.info("created Image Annotator Client successfully, used credentials:\n" + propertiesService.get("GOOGLE_VISION_SERVICE_ACCOUNT_CREDENTIAL"));
}
return imageAnnotatorClient;
}catch(Exception e){
log.error(e.getMessage());
throw new QalamException(Error.builder().message("could not create ImageAnnotatorClient : " + e.getMessage()).build());
}
}
The code doesn't reach the last logging line in the code and crashes.
and this is what I get in the logs:
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x0000000000003fd6, pid=1, tid=52
JRE version: OpenJDK Runtime Environment (17.0+14) (build 17-ea+14)
Java VM: OpenJDK 64-Bit Server VM (17-ea+14, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
Problematic frame:
C 0x0000000000003fd6
Core dump will be written. Default location: /home/app/core.1
An error report file with more information is saved as:
/home/app/hs_err_pid1.log

Windows 10 Universal App - Package doesn't work normally as debug mode

public async Task<List<Tip>> GetTips()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://APIURL ");
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse res = await request.GetResponseAsync();
StreamReader sr = new StreamReader(res.GetResponseStream());
string result = sr.ReadToEnd();
List<Tip> tips = JsonConvert.DeserializeObject<List<Tip>>(result);
return tips;
}
I am working on a project which need to consume an enterprise Web API(Https) and display the data on Win 10 live tile, it’s an UWP application.
But I found it only works when I ran it in IDE(Visual Studio 2015 debug mode) .
When I created a package for this app and run it by powershell for installation, request.GetResponseAsync method throws exception “The login request was denied”.
I tried to check Enterprise Authentication and Private Networks(Client & Server) options in Package.appxmanifest. But there was no effect.
Any idea how to make it work normally? Thanks.

CRMService.asmx - 401 Unauthorized error

CRM Portal is setup on "crmstaging" machine, on port 5555.
Following is the path of CRM Service:
http://crmstaging:5555/MSCrmServices/2007/CrmService.asmx
I am creating an ASP.NET Website on my dev machine "crmdev", and have added reference of the above service.
Now, I am trying to use various methods of this service to perform operations on my CRM entities, for that, I have written following code in button click of the page:
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "MyCompany";
CrmService service = new CrmService();
service.CrmAuthenticationTokenValue = token;
service.Credentials = new System.Net.NetworkCredential("username","password","domainname");
//service.Credentials = System.Net.CredentialCache.DefaultCredentials;
string fetch1 = #"<fetch mapping=""logical"">
<entity name=""account"">
<all-attributes/>
</entity>
</fetch>";
String result1 = service.Fetch(fetch1);
txtBox1.Text = result1;
In above code, I have passed credentials of the user having access on CRM Staging machine.
While trying to execute this code, I get an error saying "401 Unauthorized".
How to resolve this issue?

Dot Net Client and IIS hosted SignalR with Win auth

Is there a way to configure the .NET client so that it will work with a IIS hosted SingalR that uses Windows authentication?
If I disable windows authentication it works, but this is not an option
setting connection.Credentials = CredentialCache.DefaultCredentials does not help.
The code
public EventProxy(IEventAggregator eventAggregator, string hubUrl)
{
typeFinder = new TypeFinder<TProxyEvent>();
subscriptionQueue = new List<EventSubscriptionQueueItem>();
this.eventAggregator = eventAggregator;
var connection = new HubConnection(hubUrl);
connection.Credentials = CredentialCache.DefaultCredentials;
proxy = connection.CreateHubProxy("EventAggregatorProxyHub");
connection.Start().ContinueWith(o =>
{
SendQueuedSubscriptions();
proxy.On<object>("onEvent", OnEvent);
});
}
ContinueWith triggerst directly after Start and when the first subscription comes in I get a
The Start method must be called before data can be sent.
If I put a watch on the DefaultCredentials I can see that Username, Domain and Password are all String.Empty. Its a standard Console program, Enviroment.Username returns my username
Sure, set connection.Credentials = CredentialCache.DefaultCredentials. More details about credentials here http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultcredentials.aspx.

cloudfoundry groovy (java) app fails to read external url giving 403

https://groups.google.com/group/caelyf/feed/rss_v2_0_topics.xml in a browser window correctly returns xml stream;
Using groovy in cloudfoundry app, this fails with http 403 permission failure like:
def url = "https://groups.google.com/group/caelyf/feed/rss_v2_0_topics.xml:443".toURL()
def tx = url.getText('UTF-8')
cloudfoundry forum implies only https plus port 443 can read an external url
any ideas ?
not sure why you stuck :443 on the end of the url?
403 means forbidden. I'm guessing Google doesn't let you scrape the groups site with java.
you could try setting the user agent to that of a browser?
def tx = url.openConnection().with {
setRequestProperty("User-Agent", "Firefox/2.0.0.4")
inputStream.with {
def ret = getText( 'UTF-8' )
close()
ret
}
}
or similar...
I don't think this is a cloudfoundry issue. have you tried running the above from your machine to confirm this?
Edit:
Just tried it, and it works (at least on my machine). This shows how to load the XMl into a parser, and print the titles from the feed:
URL url = "https://groups.google.com/group/caelyf/feed/rss_v2_0_topics.xml".toURL()
def tx = new XmlSlurper().with { x ->
url.openConnection().with {
// Pretend to be an old Firefox version
setRequestProperty("User-Agent", "Firefox/2.0.0.4")
// Get a reader
inputStream.withReader( 'UTF-8' ) {
// and parse it with the XmlSlurper
parse( it )
}
}
}
// Print all the titles
tx.channel.item.title.each { println it }

Resources