NSFetchedResultController not getting updated - core-data

I am using a UICollectionView to manage a to-do list with a NSFetchedResultController and RestKit. When I am creating/updating an element with the postObject:/putObject: methods, NSFetchedResultController does not get updated. If I call the reload method on the collection view new objects are not present. The only solution I found is reloading all the objects with getObjectsAtPath.
New objects are well added to the backend storage as well as in the local SQLite database. I set up the NSFetchedResultController's delegate correctly and initialized it with the mainQueueManagedObjectContext.

Related

Sequelize afterFind hook in eager loading

I've two models User,Profile
I use eager loading to fetch user and it's profile.
But i need to attach image file names of every profile as an array to profile.
So when i want to fetch a profile independently, i can use FS.readDirSync to find profile files list and attach it to the Object as an array.
Is possible to do this in AfterFind hook in Sequelize and is it working in eager loading?

Error on Acumatica Create Code File for New DAC based on database table

CreatingCodeFileForNewDACFromDatabaseTable
I am trying to add a new DAC from an existing database table per the Acumatica documentation. However, when I click OK, I get an error:
localhost says "An unhandled exception has occurred in function MoveNext. Please see the trace log for more details.
Anyone seen this before? How should I proceed? Where are the trace logs stored?
Thanks,
David
The issue only happens if there is no ItemDocument table in your database.
If you've just created ItemDocument table, make sure to restart IIS or recycle app pool to make sure Acumatica is aware of the new table, as it caches database schema once, when domain starts.
When you create new DAC in the Customization Manager, its namespace will match name of the customization project:
It's necessary to type FullName of a custom DAC (inc. namespace) when using a custom DAC inside different namespace - DocCenter.ItemBaseDocumen‌​t in your case:
[PXSelector(typeof(S‌​earch<DocCenter.ItemBaseDocumen‌​t.baseDocumentCode,
OrderBy<Asc<DocCenter.ItemBase‌​Document.BaseDocument‌​Code>>>),
DescriptionField = typeof(DocCenter.ItemBaseDocum‌​ent.baseDocumentShort‌​Description))]

CRMException: Expected only one default business unit team

I've created a plugin to set some custom fields on the businessunit entity when it's created.
I registered the plugin and confirmed the context message is Create.
Now, when I create a new businessunit, I get the exception message "Expected only one default business unit team".
I'm not setting the default team and even went so far as to remove the attribute before I save the entity.
The problem was I was running in the context of Create and calling Update to save but the entity that hadn't been officially created yet.
I removed the Update() function because CRM will save my added attributes when it creates the record.

Is the default behaviour for NSManagedObjectContext save() method a blocking method?

To be very specific: If I get the managed object context from the app delegate and do not set any parameters on it, what happens when running inserts, updates followed by save()?
Does the app block on save() until done?
Yes, the save method blocks. It's not even a default-- that's how it is, always. Does't matter if the context came from the app delegate or somewhere else, save is a synchronous method.
This what it came down to:
Normally, when I create an object, I only set the main key (properties that don't change through the lifecycle of the object) on creation. I then use an update method to complete the creation. In this particular case, I changed one property on the server from 'creational' property to 'updateable' property, but I missed it in the app. So the app was deleting the objects only to have the server create them again a bit later...

Hosting and initialising multiple MVVMCross ViewModels for the MvxTabViewController

I need to create a Tab view in iOS. I tried to do this by simply adding a UITabBar to an MvxViewController but I could not get that to work (See this question if interested)
I am now trying to go use the approach MVVMCross and Apple seem to push me towards, a TabController.
In our Core project we have 4 ViewModels that are displayed from one or more places using a ShowViewModel call and are initialised with a customerNumber.
CustomerViewModel
CustomerOrdersViewModel
CustomerHistoryViewModel
ReturnsViewModel
In Android and Windows Store we have separate Views for each of these ViewModels. I do not want to change our Core implementation to support iOS. I will create a new ViewModel called TabbedCustomerViewModel and that will have 4 properties, one for each of the hosted ViewModels.
Using a custom MvxTouchViewPresenter registered in the iOS project I can listen for requests to Show one of the Customer views and then switch the Request to TabbedCustomerViewModel. I have that working, the new ViewModel gets created and the initialisation paramaters that would have been passed to the original VM are passed to the intercepting VM's Init method.
The problem I am having is knowing how I should be initialising the hosted VMs. I assume I am going to have to ctor, init and Start them manually. Has anyone got any thoughts on how to do this?
The N-25 Tab Tutorial does not have to worry about this as its hosted VMs are not standalone so don't have Init and Start dependencies
I have the initialisation of the VMs working now too. When the View loads it checks if it is within a Tabbed UI by looking at the ParentViewController.
If it is it calls a custom method on the new TabbedCustomerViewModel. I have copied the code that MVVMCross use and added it to the new Method
try
{
mvxViewModel.CallBundleMethods("Init", this.initialisationParameters);
if (reloadedState != null)
{
mvxViewModel.CallBundleMethods("ReloadState", reloadedState);
}
mvxViewModel.Start();
}
catch (Exception exception)
{
throw exception.MvxWrap("Problem initialising viewModel of type {0}", mvxViewModel.GetType().Name);
}
The initialisationParameters and reloadedState are stored by TabbedCustomerViewModel when it is initialised so that it can pass it down to the ViewModels it is hosting

Resources