iOS 8 Safari indexedDB.open returns null - ios

We are developing web app, that uses framework that uses indexedDB. All was going fine, but then we tested it on iPad and suddenly it didn't load the page at all. Thought it would be some minor issue, but after some tests we found out, that the app is crashing on:
TypeError: null is not an Object validating 'request'
It crashes on the line :
var request = indexedDB.open("FMVare",415);
This stores null in the request variable so then after that there is:
request.onerror(...)
Which will get us the error message, written above.
I spent one day looking for a fix, but only found that iOS implemetation of indexedDb is "buggy". But I cant even open a database, so there probably is problem somewhere else. My colleague also told me, that it was working fine like 1 month before, but the file with this implementation (according to git) didn't change... ever.
I tried using pollyfill to change it to the WebSQL, again it worked everywhere except iPad browsers (Safari, Chrome). This time it was throwing different error, which I only could google as far as some SQL syntax error, which obviously couldn't be the case, if it is working everywhere else.
I have tried some suggestions, which said to replace in that pollyfill indexedDB with _indexedDB etc. but again, it worked everywhere but iPad.
When I log the variable request, it returns null. If I log indexedDB or window.indexedDB, it returns IDBFactory object, so it's there, but the .open method is failing, without calling .onerror or .onsucess method.
Since I really found many people complaining about indexedDB bad implementation on iOS, it means they were able to use it. So what could be the problem in my iPad? I mean I can try update to iOS 9, but that's not exactly what are we trying to achieve.
I tried deleting cache, changing version number(greater and smaller), creating different database (different name), pollyfill... but still can't get it working, everytime i call indexedDB.open(databasename), it returns null and crashes.
Any ideas?
EDIT:
The error I'm getting with shim is
Error in sysdb transaction - when creating dbVersions.
Then I get the SQLError object with
"code: 5"
and
"message: could not prepare statement (1 not authorized)"
The error happens in createSysDB(success, failure) function of the shim.
UPDATE:
I tried an app on iPad called WebView Rendering so i could try if WKWebView would be capable of running my app. And it was! So the problem really was the UIWebView support of IndexedDB.
Seems very strange to me though, that you can't use IndexedDB on iOS Safari even after update on latest iOS version.

Related

React-Native ios App crashes without report

I'm building an iOS app using React Native and trying to get it testable on phones.
If I plug my phone into the computer and "build" directly to the phone, the app is built correctly and opens/operates correctly, no problem.
But if I try to archive it and send it to phones using iTunes Connect's TestFlight or Fabric with Crashlytics, the app crashes immediately upon opening. It briefly shows the launch screen, but no more.
Moreover, there are no crash reports -- in TestFlight, in Crashlytics, or in XCode, once I plug the phone back in. So I'm operating in the dark here, without any information on what's breaking. Haven't been able to find a similar issue online, so I figured I'd just ask. Any ideas what could be going wrong?
Please let me know if there's any code or other data you might need to see. Some of it's confidential, but I'll try to post an approximate version.
As Chris Geirman suggested, the problem was a JavaScript error. I'm not sure people with similar problems will find this thread, but in case they do, here is the weird error that was occurring.
I had created a simple ORM system, with a BaseModel and a bunch of models that inherited from it. The BaseModel constructor looked like this:
constructor(props = {}, relations = {}) {
Object.keys(props).forEach((k) => {
// Save props to object
this[k] = props[k];
});
this.relations = relations;
this.className = this.constructor.name;
}
That last line was the problem. On my local simulator and if I build the app to my phone by plugging it in, this works fine. As in, if a Message model inherits from BaseModel, calling var msg = new Message(data, relations); msg.className returns Message.
But something about bundling/archiving/sending the app through TestFlight or Fabric.io minifies and uglifies the JavaScript, such that the class names are changed. So instead, if I do this -- var msg = new Message(data, relations); msg.className -- I'll get back a random variable name, something like 't'.
This was a problem in my app, because my home page contained a switch statement that worked off of the className:
iconContent() {
return {
Message: {
icon: <Image style={styles.feedItemIconImage} source={ require('../assets/img/icon_message.png') } />,
color: c.grass
}, ...
}[this.props.className] // from the model item
}
But 'Message' wasn't, as expected, the value of this.props.className -- 't' was. And so, if I were to try to tunnel into, say, the color value, I'd hit an error, because I was trying to access the color property of null.
Why that didn't report, I don't know (I followed Chris's suggestions and installed Sentry, but it still seemed not to report that error).
But that's what was going on. Minification/uglification occurred only when I installed the app on a phone via TestFlight/Fabric, and that's why the app only crashed in those conditions.
Hope this saves anyone running into a similar bug from tearing out their hair.
I'd like to share my own experience of production stage crash, whereas everything worked fine in development stage.
I had the similar problem which caused by the Reactotron logger. Since I'm not bundling it in production stage, a single line of console.tron.log crashed my app with full stealth. (Its kinda my fault, since I didn't give a damn about my linter with 'no-console' setting)
Here's the code snippet I introduce in my root level file, root.js.
if (__DEV__) {
...
console.tron = Reactotron;
...
}
Hope somebody finds this before wasting time figuring out what's wrong.
Not sure if you still have this problem - but if you do, I'd recommend checking out Bugsnag for react native error reporting - which reports crashes in both the JavaScript layer as well as the native layers (java/cocoa).
One of the harder problems to solve in react native crash reporting (as Sasha mentioned) is restoring the original stack traces when using minification and/or obfuscation - this is handled in Bugsnag by providing full support for JS source maps, as well as iOS symbolication and Android Proguard support at the native layers.
Let me know if this helps - I'm a founder # Bugsnag

Web service call missing field value xamarin IOS

I'm having a web reference which is being used by both a Xamarin IOS application, Xamaring Android application, and a Windows Store application.
And this all worked very well, until I updated Xamarin.
Now, there is a field that But it works fine for the Android and Windows applications.
I have tried to update the web reference multiple times, with no luck. I have also tried to debug the web service locally, to see if it returns the same , which it does.
When I receive it in my Windows Store app., it looks like this:
And in my IOS app., it looks like this:
It is always the StructureId that is never set, for some reason. And it was not like that before I updated Xamarin.
Anyone who knows what I am doing wrong, or have stumbled onto the same kind of problem ?
That looks like the linker removed unused members. Defaults have not changed (it's not related to your update) but you should check that your application is being built with Link SDK (and not Link all).
If you want a smaller executable and set Link all to achieve this then you'll need to add [Preserve] attributes on the structure you're serializing (e.g. used in web services).
I was able to make it work. I am not sure if it cached anything, or what, but it helped to add some "noise" on the webservice call.
I just added DateTime.Now.Ticks to my webservice URL in Reference.cs, so it would always be a new URL call:
this.Url = "http://somewebsitename.com/ReportService/ReportService.asmx?v=" + DateTime.Now.Ticks;

Cordova resolveLocalFileSystemURL success call back failing on iOS

I've just created a new project and installed the file and file-transfer api's via CLI. I have already created a working app previously so I know how to use phonegap and have been doing so for a few years now.
Here is the code:
window.resolveLocalFileSystemURL("file:///localhost/var/mobile/Applications/96B4705C-C70D-4340-9A42-HJ1F28355D43/tmp/cdv_photo_015.jpg", function(fileEntry){
console.log(fileEntry.name);
}, function(error){
console.log('about to resolve this files errors');
console.log(error.code);
});
Nothing ever gets outputted in the console debugging window ...and yes I have debug installed cause I have console.log() in other parts of my code that show up.
It seems like there is an issue when passing URL data from navigator.camera.getPicture() to the file API when using window.resolveLocalFileSystemURL()...any ideas anyone. I'm up to date on phonegap api and everything and I have this issue for the past few days now...I can't seem to solve it.
***EDIT***
Seems like when you use Camera.DestinationType.FILE_URI as a parameter for navigator.camera.getPicture(). When you choose a picture and the success call back for navigator.camera.getPicture() is triggered, trying to window.resolveLocalFileSystemURL from the URL that getPicture returns just fails. But if you set Camera.DestinationType.NATIVE_URI it at least returns something but it's in a format that can't be used with the file-transfer api exp: assets-library://asset/asset.JPG?id=220BCEAE-F1EA-4A6A-83B2-AB8833A90BF2&ext=JPG
Seems like this was a bug in the file api v1.0.0
https://issues.apache.org/jira/browse/CB-6116
Temp solution is there as well.
Seems like "/local/" was causing the issue. Remove it from incoming uri's if it exist and the resolve should work.

ios calendar event from website ics

I have a page where I have a link with an ics file.
Using safari the problem is that when downloading and importing the event into the calendar is showing the wrong event, precissely an old one.
The strange situation of this is that obviously some cache or trace from the old file is getting gathered instead of the new ics file, more strange to me at least is the fact that I deleted everything like cache history, calendar entries, etc. , even changed the URL to an invalid one and then does nothing, and the correct one still remains with the old event information from 3 months old.
I tried searching here and internet about reason of this behaviour but I havent find any logical reason.
I also changed all settings under icloud and under Mail,contacts, Calendars without success.
Does anyone knows about this weird behaviour Im facing?
Ok I solved my problem.
The issue was the UID on the .ics. Needs to be Unique and I had it repeated.
Probably is a "stupid" reason but got me crazy. I leave this for someone who would have this kind of "stupid" issue in the future.

Error deserializing wallpaper image : iPad

What does the following error indicates
5/19/11 8:06:45 PM SpringBoard[9712] Error deserializing
wallpaper image: Error
Domain=CPBitmapErrorDomain Code=0 "The
operation couldn’t be completed.
(CPBitmapErrorDomain error 0 - No data
provided to
CPBitmapCreateImagesFromData)"
UserInfo=0x70b9c80 {NSDescription=No
data provided to
CPBitmapCreateImagesFromData}
Well, if you read the error message, it is telling you that a wallpaper was unable to be deserialised because no data was provided to the function named CPBitMapCreateImagesFromData. Pretty self explanitory.
Other than that, it sounds like you're either working on a jailbroken phone or trying to do things that aren't supported by the official iOS SDK - in which case my help ends here.
Or you're a user who is trying to understand why an image they set as a wallpaper isn't displaying and found their way to the iPad's console - in which case, this isn't the place to be asking.
This happened to me also, I think it's because most of the tutorials are written with an iphone in mind and I was using an iPad. I was working with an ipad and when following these tutorials i was getting this problem.
When you are creating the project I choose View based application. In the same wizard there's a combo box for 'iPhone' and 'iPad'.. If I leave that as iPhone then my application doesnt start in the simulator and I see the error you mention. If I set that to iPad then everything works fine.
I dont understand why that should make a difference tbh..
This happened to me, but only when I was not debugging, what happened was that in the dealloc function [super dealloc] was called at the top of the function rather than at the end. The "deserializing wallpaper" message is probably due to some sort of memory corruption that occurred since I had code after [super dealloc] trying to use pointers that were now garbage. I had NSZombie activated but it had no effect. Why this only crashed when I was not hooked up to the debugger is beyond me at the moment.
Thankfully this bug was fixed after a few diffs in source control, but initially I was pretty perplexed at the message and the fact that it was a bug where the debugger couldn't be used only induced more panic.
I'm sure you've long fixed your problem but I thought it'd be helpful to put this out there for others.

Resources