We have a wrapper screen of Production Order, and using same allocation button as on production Order,
It is working as expected when there is single line added in the allocation popup, as soon as second line is added, we are getting object reference error.
I think there is some events bind in LSProdMatlLine but these events are not fired when used by other screen.
can you please help me to provide details for using the allocation feature and overriding it.
Error was due to the cache inheritance problem within the same PXGraph where the Base class (INLotSerialStatus) and Derived class (LotSerialStatus) share the same cache and so, while trying to access/get the cache of the derived object, it returns the cache of the base type instead of the derived type, thus throwing the “Unable to Cast” error.
So, in order to avoid the error, a dummy view cache for the base type before creating any other views as follows:
public PXSelect<INLotSerialStatus> dummyINLotSerial;
Related
I am currently attempting to create a new Activity type that has it's own maintenance screen.
The most logical approach I came up with was to create a new subclass based on CRActivity with the PXSubstitute flag to replace the stock value with mine that has the extra class types in it.
This works for displaying my new class on the screen however whenever I click on any of the items I always receive the message:
Error #97: A cache instance cannot be created for the type CRActivity.
For reference, here is how i'm defining my new class
[CRActivityPrimaryGraph]
[Serializable]
[PXSubstitute()]
[PXCacheName(PX.Objects.CR.Messages.ActivityClassInfo)]
[PXEMailSource]
public partial class CustCRActivity : CRActivity
{
.....
}
I took a step back and tried another approach by doing the same process but for CRPMTimeActivity. This causes all of the standard Class types to work but my new type gives the same type due to the CRActivityPrimaryGraph not knowing what my new activity type's nagivation is.
Has anyone ever created a new activity type such as this?
Updated 4/28
Below is a screenshot of what I was attempting to accomplish
I did finally get it to work but not quite the way I was hoping.
The initial error message was apparently build specific. After updating to a newer build that particular error went away.
What I discovered was even though I could Substitute CRActivity, most of the screens themselves were utilizing CRPMTimeActivity which has different attributes associated to it. CRPMTimeActivity is a subclass of CRActivity and the majority of the processes cast the activity to CRActivity.
A subclass of CRPMTimeActivity cannot be cast as CRActivity. Because PXSubsitute relies on the base class, this caused casting issues when attempting to add new activities.
In the end I had to create my own custom CRPMTimeActivity class and the base classes then customize the screens themselves to use my version of the activity builders.
The result is shown in the screen shot
Coded ui- How to update properties of object in UImap.uitest file which has changed in application? for example a window which has version of software changes with every build. The issue is if I try to record anything on new version of software it creates new objects in UImap and the whole object tree again. This makes UImap too huge adding duplicates of objects with slightly different property.
You don't want to update the properties to latest, but make the property values dynamic. Just updating the properties will mean more work the next time your code changes.
Also, try to only use properties to search on that do not change between application runs/versions. Example, a class property will likely remain static between runs, while the title of your parent window may change based on the version number. Check out this article to see how to modify the recording's search properties to fit your needs, specifically the section on modifying UI action properties.
Another method to look into would be to create the objects and methods yourself using C#. By adding controls yourself to the uimap.cs partial class of the .uitest, you have can specify at design time what properties and values that Coded UI uses to execute your tests.
For every managed object that is sent via iCloud update, this warning/error is sent to the console:
*** ERROR: this process has called an NSArray-taking method, such as
initWithArray:, and passed in an NSSet object. This is being
worked-around for now, but will soon cause you grief.
My managed objects are Clients and have a one to many relationship with assessments as shown below.
class Client: NSManagedObject {
//other NSManaged vars are here
#NSManaged var assessment: NSOrderedSet
}
Judging by the timing of this error (during ubiquitous updates) and the fact that this is my only use of NSSet objects in my project, I can presume that a function during this update is being passed an NSOrderedSet when its expecting an NSArray.
Turning off iCloud removes the errors.
I found two other folks with a very similar issue:
Using iCloud enabled Core Data NSArray-taking method
Core Data Relation between Objects
However, neither offers any solution to my problem. Everything is working fine right now, however "it will soon cause you grief."
If this isn't resolved here, I'll take this issue up with the apple dev support.
I figured it out how to fix this error after much research. (No help in from the Apple Dev forums).
This is error is caused by the Swift 1.2 upgrade. They encourage you to use their new Set<> class instead of NSSet. The error was a vague way of reinforcing that claim.
Ordering of my data was ultimately handled by my NSFetchedResultsController, so I didn't need the stored data to be ordered. So I set out on a task to change the data type for my one to many relationship from NSOrderedSet to Set.
So I created a new data model, selected my relationship and unchecked "Ordered" in the data model inspector. Then migrated to the new model in the next run. (as shown below)
Once that was done, I changed the data type in my managed object subclass from NSOrderedSet to Set. (or Set). That generated compiler errors that were easy to fix throughout my code.
The new Set class easily converts to an array: Array(mySet)
To insert an object to the set, there's an easy insert method. foo.mySet.insert(objectToInsert).
Side note: Converting my relationship to a Set also fixed some weird ordering issues I was having with my table views and the NSFetchedResultsController.
Then I ran the program, generated data, uninstalled the program. Ran the program again and watch the glorious iCloud data populate without the annoying errors.
Boom. I hope this saves someone out there the 10 hours of turmoil (I tried a lot of different things..) I spent to fix this.
It seems controllerDidChangeContent: is being called as soon as I create a new managed object in my context. The documentation seems to suggest this method is called only once you save: the context.
This "bug" if it is one, is causing my application to crash because as part of my table view cell, I need to load other managed objects that don't exist at the time of creating the main managed object.
Someone seems to have spotted this too, please check out the following link and I would love to hear your opinions on this: http://openradar.appspot.com/10207615
More information
Although the link I added to this post showcases an example using two NSManagedObjectContext, my application is using one context, but the controllerDidChangeContent: is being messaged none the less as soon as an object is created in the one and only context, and controllerDidChangeContent: is being called a second time when I save: this context. It is to my understanding that this method should only be messaged when the context is saved.
The solution is to avoid dealing with more than one managedObjectContext. If your cell needs to load other managed objects, it should still use the same managed object context as the main managed object.
I have yet to see a use case where it is absolutely unavoidable to use more than one managed object context referring to the same model active at the same time.
In a subclass of NSManagedObject my overridden implementation of willTurnIntoFault is being called twice when undoing some code which originally created the object in question. This results in a crash when attempting to double-unregister for KVO on a key path.
The Apple documents say this is the right place to un-register for KVO.
A bit of context - the undo operation involves removing the corresponding view of the model from it's superview. The view retains it's model.
So my question is: what kind of programmer errors can result in willTurnIntoFault being called twice in a subclass of NSManagedObject?
Note: Previously I was overriding dealloc in this class but have since realised this is not recommended for subclasses of NSManagedObject. I've since moved this code into -didTurnIntoFault. I'm not currently overriding any other methods which the Apple docs say you should not override.
For posterity's sake: I had the same problem. In my case I had an object A with a (to-one) relation to an object B. When A got deleted B's inverse relation to A was set to null. This caused B's observeValueOfKeyPath:ofObject:change:context method to be invoked (where keypath was B's relation to A). Unfortunately this method checked a property of A, causing the faulting of A to be cancelled (note that in this situation awakeFromFetch does not get called--I presume because the object never actually did get to fault state). Hence I might might get a second call to willTurnIntoFault later and the object would try to unregister for KVO again, resulting in a crash--just like in the OP.
For me the solution was to change the delete rule for A to cascade, so that the B object got deleted when the A object got deleted AND to unregister for KVO in prepareForDeletion. This is important because the deletion of A will still cause B's inverse relation to be set to nil before B is actually deleted.
Note that prepareForDeletion gets called before but not instead of willTurnIntoFault. Hence, if you unregister for KVO in both, you need to maintain some state to make sure you have not already unregistered.
Seems the issue was caused by a custom setter method which was setting/unsetting KVO values from within willTurnIntoFault.