After upgrading to IOS 16.2 getting below exception when trying to access database.
on IOS version 16.1 and below everything works fine.
SqfliteDatabaseException: DatabaseException(open_failed /var/mobile/Containers/Data/Application/494EB596-3835-462C-8164-2B773A19A1C4/Documents/main.db)
File "exception_impl.dart", line 11, in wrapDatabaseException
File "database_mixin.dart", line 737, in SqfliteDatabaseMixin.openDatabase
File "database_mixin.dart", line 839, in SqfliteDatabaseMixin.doOpen
File "database.dart", line 46, in SqfliteDatabaseOpenHelper.openDatabase
File "factory_mixin.dart", line 110, in SqfliteDatabaseFactoryMixin.openDatabase.\<fn\>
...
20 additional frame(s) were not displayed)
Platform: IOS
IOS version: 16.2
Device: iPhone 13 pro max.
flutter: 3.3.3
Code: databaseFactory.openDatabase(path, options: options);
Plugin: sqflite
On first launch this exception is thrown, but if I close app and relaunch it then it works fine.
I checked if database exists also I added additional catch to get database path from both path_provider and sqflite plugin.
var documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "main.db");
try
{
await databaseFactory.openDatabase(path, options: options);
} catch(_) {
try
{
var databasesPath = await getDatabasesPath();
String path = join(databasesPath, 'main.db');
return await databaseFactory.openDatabase(path, options: options);
} catch(e, stackTrace){
reportException(e, stackTrace);
}
}
Related
when trying to load tflite model it showes error on IOS device i'm using flutter and xcode. i don't know if we have to update anything in xcode in order to use the Gpu Delegate, i want to use Gpu delegate the code is below
Future loadModel() async {
try {
final gpuDelegate = tflite.GpuDelegate(
options: tflite.GpuDelegateOptions(
allowPrecisionLoss: false,
waitType: tflite.TFLGpuDelegateWaitType.active,
enableQuantization: true),
);
var interpreterOptions = tflite.InterpreterOptions()
..addDelegate(gpuDelegate);
_interpreter = await Interpreter.fromAsset('your_model.tflite',
options: interpreterOptions);
print('model loaded successfully');
print('load model1===model loaded successfully');
} catch (e) {
}
}
My app working correctly on Android but I have exception on iOS.
The iOS build was done on Codemagic.
Dev. environment - Windows Flutter Dart.
What is missing?
The exception on the following line in mainCommon
FirebaseApp firebaseApp = await Firebase.initializeApp();
mainCommon -
Future<void> mainCommon() async {
try {
loggerDBND("START - MainComminStart0");
FirebaseApp firebaseApp = await Firebase.initializeApp();
loggerDBND("START - MainComminStart1");
FirebaseMessaging.onBackgroundMessage(_messageHandler0);
loggerDBND("START - MainComminStart2");
globals.messaging = await FirebaseMessaging.instance;
loggerDBND("START - MainComminStart3");
globals.messaging.requestPermission();
loggerDBND("START - MainComminStart4");
await globals.messaging.subscribeToTopic("messaging");
loggerDBND("START - MainComminStart5");
globals.messaging.getToken().then((value) {
print("Token -" + value.toString() + "-");
});
loggerDBND("START - MainComminStart6");
} on Exception catch (exception) {
loggerDBN("mainCommon - exception"+exception.toString() );
} catch (error) {
loggerDBN("mainCommon - error" + error.toString());
}
The exception -
main- error[core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project?
View the iOS Installation documentation for more information: https://firebase.flutter.dev/docs/installation/ios
File "GoogleService-Info.plist" location - ....\ios\Runner
In a similar issue from the past, adding GoogleService-Info.plist to the correct folder by dragging and dropping the file using Apple's Xcode was the solution.
Another user provided a windows workaround
i am new to electron.
i used Vue CLI Plugin Electron Builder to create base project.
in window BrowserWindow.LoadURL it work.
but on macos BrowserWindow.LoadURL not working.
macos version 10.10.5,
electron version 11.4.7
try {
//it not working on macos
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
} catch (err) {
//can't catch any err on macos
console.log(`loadURL err, url: ${process.env.WEBPACK_DEV_SERVER_URL}, info: ${err}`)
}
i searched a lot for the answer, but didn't get any answer for this.
can any suggest a solution for this? any help will be appreciated.
run electron
safari loads url
Below the loadURL function...
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
Try to add this code block to check if the content of the page is ready or if it has finished loading. If it is, show the window and focus on it.
win.webContents.on('did-finish-load', () => {
if (!win) {
throw new Error('`win` is not defined');
}
if (process.env.START_MINIMIZED) {
win.minimize();
} else {
win.show();
win.focus();
}
});
Context:
Hello, I am working on a Ionic application (made in Typescript). In this application, I control a wifi camera via HTTP Request to the IP (http://192.72.1.1/myCommand to be precise).
Main actions I do with the camera:
Start recording
Stop recording
Get videos list
Download a video
When I use the Ionic DevApp:
With the Ionic DevApp, everything works perfectly, I can do all mains actions without a problem.
When I compile the application on IOS:
I compile with the command ionic cordova build ios --prod, then I archive with Xcode and send it to the AppStore to test it with Test Flight.
I got no errors while compiling / archive the application. But when I try it on my iPhone, I can start / stop recording, but can't download the video.
Problem:
Some commands are not working, but I don't know if it is getting the list or downloading the video, I have no logs. I don't understand why some commands are working but others no.
IOS is blocking download requests? How to solve my problem?
Notes:
I already tried all basic things like delete the IOS platform, recompile, uninstall, ...
I tried different Ionic HTTP plugins, same problem with all of them.
Some code:
Start / Stop the camera: (it is the same command to start / stop).
startCamera(){
var url = "http://192.72.1.1/changeRecordStatus";
var result = this.http.get(url);
result.subscribe(data => {
console.log("Works");
},
err => {
console.log("Error" + err);
}
);
}
Getting the name of the last video:
getLastVideo(){
var url = "http://192.72.1.1/listVideos";
this.http.get(url, {}, {})
.then(data => {
var xml = data.data
var xmlDOM = new DOMParser().parseFromString(xml, 'text/xml');
var temp = this.xmlToJson(xmlDOM); // function that convert XML to JSON
var resultArray = Object.keys(temp).map(function(i){
let ite = temp[i];
return ite;
});
resultArray = resultArray[0]['file'].reverse();
this.lastVideo = resultArray[0]['name']; // lastVideo is a global variable
},
(error) =>{
console.log("Error while getting the name of the last video" + error);
});
}
Downloading the file from the camera:
downloadFileFromCamera() {
this.getLastVideo();
var basename_file = this.lastVideo;
var url = "http://192.72.1.1" + basename_file;
this.fileTransfer.download(encodeURI(url), this.file.dataDirectory + '/videos/' + basename_file, true).then((entry) => {
this.video[this.counterVideos] = entry; // video is a global array
this.counterVideos +=1;
}, (error) => {
console.log("Error while downloading the last video" + error);
});
}
If someone knows how to solve my problem, I would be so grateful! Thanks in advance.
I'm a little confused with the filetransfer method of Cordova for iOS. (I had a version working with Android)
Apparently, I don't set the destination folder properly. target:null Could not create target file Note that I assume that the directory exists as it is created with success earlier in the script.
According to the Cordova documentation, I should use a entry.toURL to get the right path.
function download(filename){
var localPath = rootFS.toURL+'contentImages/'+filename;
var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI('http://myValidatedSource.com/'+filename),
localpath,
function(entry){
console.log('download completed for '+entry.fullPath);
},
function(error){
console.log(error);
}
);
}
I also tried this:
alert(rootFS.fullPath); ==> "/"
and
alert(rootFS.toURL); ==> "function(){
if (this.nativeURL){
return this.nativeURL;
}
return this.toInternalURL()|| "file://localhost"+this.fullPath";
}"
I was not so far...
var localPath = rootFS().toURL+'contentImages/'+filename;
instead of
var localPath = rootFS.toURL+'contentImages/'+filename;