App crashes when using MagicalRecord in release build - magicalrecord

Our app uses MagicalRecord to store data in Core Data. It have worked fine so far, but now, after adding fields to my tables, the app crashes, but only in release builds.
When I upgrade via cable, it works just fine, but when I use Ad-Hoc (Enterprise) distribtion to upgrade the app, the app crashes.
The problem is I don't get any debug data on the crash because of this. The only thing I get is a "exited abnormally with signal 11: Segmentation fault: 11" error.
Crash report:
(http://pastebin.com/64c4jvgJ)
I assume the issue might be related to needing migration, but I can't find any good documentation on how this is supposed to work. Any pointers in the right direction is welcome.
Update:
More info -
Before updating my datamodel, i had a store called PAM.sqlite, and a non-versioned store called PAM.xcdatamodeld. Now i have a versioned store, called PAM & PAM 2.
I use this code to attempt an automigration, but it does not work:
[MagicalRecord setDefaultModelNamed:#"PAM 2.xcdatamodel"];
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"PAM.sqlite"];

You need to specify the extenstion of the data model (e.g. MyProjectDB.momd)
so, the code syntax would be:
[MagicalRecord setDefaultModelNamed:#"MyProjectDB.momd"];
Found the answer here

I had the same issue. Try to add new version in xcdatamodeld. Then activate it as current. Open it in finder. Choose show package content. You will see two files for both of your versions. Replace the one for old version with non-versioned file from your old build. Use this
[MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:#"PAM.sqlite"];
So your project will have two versions of db. And will have an ability to migrate automatically.

Default settings of MagicalRecord for iOS (https://github.com/magicalpanda/MagicalRecord) is something like this
#ifdef DEBUG
[self setShouldDeleteStoreOnModelMismatch:YES];
#else
[self setShouldDeleteStoreOnModelMismatch:NO];
#endif
That means,If there is change in database model in DEBUG mode,they will simply delete older version of data model.I believe this has been fixed in latest version of Magical record.
If not, change it to
#ifdef DEBUG
[self setShouldDeleteStoreOnModelMismatch:NO];
#else
[self setShouldDeleteStoreOnModelMismatch:NO];
#endif
and fix migration code

Related

Xamarin.Auth AccountStore - KeyStore was not initialized

I've had this Xamarin.Auth AccountStore working in my app for a while, but then decided to do some updates to some Nuget Packages and Target Android versions >_<
I now have no idea what went wrong and how to get it working again, here is the exception:
Java.Security.KeyStoreException: KeyStore was not initialized
The code is pretty simple and looks like this:
var accountStore = AccountStore.Create(Android.App.Application.Context);
var accounts = accountStore.FindAccountsForService(providerName);
The 2nd line is throwing the exception.
This is in the Android project, being called from a PCL DependencyService.
It has been working this way for a while, I guess something changed in a version update in one of the packages but I don't know what, any ideas?
try to repair your visual studio installation.
This made the trick for our project. We had the same problems like you.

Qt Installer Framework: Auto Update

I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is:
Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts?
Check for updates would be enough, since the installation itself can be done using the maintanance tool.
All I could find about this topic was this small sentence:
End users can use the maintenance tool to install additional components from the server after the initial installation, as well as to receive automatic updates to content as soon as the updates are published on the server.
from here: http://doc.qt.io/qtinstallerframework/ifw-overview.html#choosing-installer-type
Thanks for your help!
Edit: Suggestion
Based on this question's accepted answere I created a small library to automatically check for updates using the installer framework - https://github.com/Skycoder42/QtAutoUpdater
What I do, is run the maintenance tool using QProcess, and then check the output. It has a mode where it doesn't run the GUI but only outputs update information if available.
Note that I set the working directory to the application's path when the applications starts, so I can just run maintenancetool.
QProcess process;
process.start("maintenancetool --checkupdates");
// Wait until the update tool is finished
process.waitForFinished();
if(process.error() != QProcess::UnknownError)
{
qDebug() << "Error checking for updates";
return false;
}
// Read the output
QByteArray data = process.readAllStandardOutput();
// No output means no updates available
// Note that the exit code will also be 1, but we don't use that
// Also note that we should parse the output instead of just checking if it is empty if we want specific update info
if(data.isEmpty())
{
qDebug() << "No updates available";
return false;
}
// Call the maintenance tool binary
// Note: we start it detached because this application need to close for the update
QStringList args("--updater");
bool success = QProcess::startDetached("maintenancetool", args);
// Close the application
qApp->closeAllWindows();
In the latest Qt Installer Framework 4.1 --checkupdates returns nothing, use ch or check-updates instead.
Commands:
in, install - install default or selected packages - <pkg ...>
ch, check-updates - show available updates information on maintenance tool
up, update - update all or selected packages - <pkg ...>
rm, remove - uninstall packages and their child components - <pkg ...>
li, list - list currently installed packages - <regexp>
se, search - search available packages - <regexp>
co, create-offline - create offline installer from selected packages - <pkg ...>
pr, purge - uninstall all packages and remove entire program directory
I just found a pretty nice implementation on GitHub:
https://github.com/ioriayane/TheArtOfQt2/blob/master/src/HelloWorld/maintenancetool.cpp
It takes care of handling Windows, MacOS and Linux. + It is written to use in QML / Qt Quick bindings (+ example).
It has some Japanese comments, but is Apache 2.0 licensed, so freely to use (following Apache 2.0 requirement).
There's a section in the guide about how to do it, but they call it promoting updates rather than auto updates, IFW Updates on doc.qt.io.

Error Message: ARC is required to compile Pushwoosh SDK

I am new in xcode.
I got recurring message error when building for testing:
*PWRequest.m
User defined issues
"ARC is required to compile Pushwoosh SDK"*
In code it shows:
#if ! __has_feature(objc_arc)
#error "ARC is required to compile Pushwoosh SDK"
#endif
I don't understand. I added a new pushwoosh sdk.
I thank you very much for your help.
You can set ARC on a file basis. Go to the BuildPhases->CompileSources. You can select sources there and pass ARC flag.
Same as here:
How can I disable ARC for a single file in a project?
but with -fobjc-arc flag
You can use XCode project that comes with the SDK. In this case you'll be linking to the output (library) that is produced by this project.
Hope it helps!
So if you want to use Pushwoosh in your app, you're going to need to turn on ARC in your project settings.
And then you'll be using ARC in your app.
Which is somewhat nicer than doing good old fashioned Manual Retain / Release memory management, yes?
If you are determined to use MRC (manual retain count), then follow the steps in this related question.

ASP.NET using AtalaSoft to convert Tiff compression

Using Atalasoft's free SDK,
http://www.atalasoft.com/free-dotnet-image-sdk
I added reference to the DotImage and DotImage.Lib dlls' to Visual Studio 2010.
My code:-
Atalasoft.Imaging.AtalaImage image = new Atalasoft.Imaging.AtalaImage(fileName);
Atalasoft.Imaging.Codec.TiffEncoder encoder = new Atalasoft.Imaging.Codec.TiffEncoder();
encoder.Compression = Atalasoft.Imaging.Codec.TiffCompression.Group4FaxEncoding;
image.Save(fileName, encoder, null); // destroys the original.
However when I run the code I get an error on the very first line:-
Unable to retrieve security descriptor for this frame.
Can anyone help me out with this?
Update:-
I added a further line of code:-
System.Security.Permissions.FileIOPermission f2 = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.AllAccess, fileName);
Still the same error.
Philo,
Hi, I'm the support engineer you called in to yesterday. I apologize - after you called in, I received a note from our chief software architect asking us to help you out.
If you are still experiencing your issue, please do call back in and/or create a support case on our portal at https://www.atalasoft.com/support/my-portal/cases
A couple of tings that come to mind from your case: make sure you're targeting either x86 or x64 in your project's platform target (DotImage "has bitness") and make sure you're using the appropriate x86 or x64 Atalasoft references. (I strongly suggest our x86 while getting started as x64 has some additional hoops to jump through to get the licensing working.
Atalasoft does ship some AnyCPU dlls but they're for an extremely limited subset of use cases and if you have referenced those and/or are attempting to target your project to AnyCPU, this will cause all sorts of odd behavior.
Also, if you're targeting our .NET framework 4.0, make sure you're targeting the full framework and not "Client Profile" as DotImage has dependencies on components not present in the Client Profile version.
~DigitalSorceress
Did you have the the file with .lic extension in project section on the right side? Make sure about that.

Qt Application throws an Access violation exception during startup

I have a Qt Application that works in Debug mode without any problems. Since two days I'm trying to make it work in Release mode. After some Project property modification I managed to compile without errors. But unfortunalty the application crashes before even reaching the main method.
That's my environment:
MS VS 2010
Qt 4.8.4
Qwt 6.0.0
I don't know if this is relevant, but I also installed the Qt plugin for VS and used Qt Designer to create my GUI.
As I said in Debug mode there is no problem. Starting the release version from the Visual Studio produces the following error:
Unhandled exception at 0x77c415de in Application.exe: 0xC0000005: Access violation reading location 0x0000000c.
The last function I can "debug" is the the "WinMain" method called inside the method "__declspec(noinline) int __tmainCRTStartup", which is located in crtexe.c (honestly I have no idea what this is). The call stack looks like this:
ntdll.dll!77c415de()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!77c415de()
ntdll.dll!77c3014e()
msvcr100.dll!718f0269()
msvcr100.dll!718f233b()
msvcr100.dll!718f233b()
msvcr100.dll!718f233b()
QtCore4.dll!5b2cfc49()
QtGui4.dll!57bf54ea()
Application.exe!__tmainCRTStartup() Line 547 + 0x1c bytes C
kernel32.dll!754633aa()
ntdll.dll!77c59ef2()
ntdll.dll!77c59ec5()
In the moment I'm totaly lost with this problem. No idea what to try further...
I've tried to reduce the program and commented out the complete main function. But the result was the same behaviour. As I said the error occurs even before the main function is called. I also turned off all optimization and recompiled... didn't changed anything.
What completly puzzles me, is the fact that it "works" when I call "Application.exe" from the command prompt (ok it also crashes but much later during execution). Weird, isn't it? What is the difference between starting from command prompt and starting from Visual Studio application?
AnatolyS and npiau thanks for you tips. Meanwhile I continued digging in my code. More or less I started from the very beginning and finally got the place the error occurs. I suppose npiau is right, it has nothing to do with Qt.
It's still (for me) a strange problem. I posted it in a new thread (because it has little to do with this thread): C++ Creation of a Singleton object in initializer list causes an Access Violation (only Release Mode)
The problem is not in QT but in your source code. "0xC0000005: Access violation reading location 0x0000000c" means that you try to access a wrong memory location.
Check out your arrays, ans pointers.

Resources