MacOS IOS Compatibility

There seems to be more apps, expecially from Apple, Inc. that share document files. Assuming that some of these use CoreData, some questions arrise. Our own Mac app uses CoreData and was innitially done before IOS even existed. Although many managed objects and entities may use the same data, many do not. Two of the biggest offenders are colors and BezierPaths. NSBezierPath and UIBezierPath appear to be functionally equivalent, but with minor differences such as constructors using radians vs. degrees. Surely this could have been reconciled to allow either -- but it wasn't. My theory is that early IOS creators figured there would be little crossover between Mac and IOS, due to the limited processing power of the iPhone processor chips. Of course, that is no longer the case, and more and more capabilities (e.g., AVFoundation) are showing up on both platforms.


So how does one convert to a storage system that supports both platforms? If starting from scratch, I would have used my own CPBezierPath (CP for "CrossPlatform"} to containn the CGPathRef and accompanying properties, with #ifdefs where needed for the platform specific variants. Maybe we can still do that by doing mapped CoreData migration.


Another scary approach would be to try to define NSBezierPath on iOS and UIBezierPath on Mac. Unfortunately, we are not privy to the specific data structures of these elements. It would certainly be helpful if Apple, Inc. were to provide a blessed definition and translation between these (and a few other objects).


In our case, we would like to have compatible drawing capability, especially now that the Apple Pencil is moving down to the lower iPads. We would like to draw on one platform and see the results on both it and the other, maybe connected by Multipeer. We also have a rather complex CALayer stack, but that is mostly compatible.


So far, I haven't seem much discussion about cross-platform CoreData compatibility. I would welcome comments on the subject.

Replies

Hello applegg,

Core Data only supports basic, low-level data types. If you are representing any other type of data, it is your responsibility to encode it somehow.


Apple is not going to provide any automatic translation across platforms. If the rumors are true, the Mac platform and all "NS" structures will soon be deprecated. But even if that happens, you still won't be able to assume binary compatibility across platforms.

I have no illusions about currently having it. I have hopes that, at some point, we WILL have it. CoreData does support transformable types, including NSObjects which conform to NSCoding, which is certainly beyond " basic, low-level data types". Sorry, I don't buy the theory, like the movie "Downfall" which I watched last night, where the ****** supporters blamed the German people for their downfall because of them believing and accepting the lies they had been told by their leaders. Maybe some cynicism is warranted, like for the Apple-mandated "Garbage Collection".


Not sure about any rumors, although I did see one about a cross-platform framework. I suppose it would be prudent to at least wait until WWDC before making any major changes. I find it very surprising that there is little or no discussion of cross platform development or data sets, especially when Apple itself is heavily invested is such for their own apps.

> I find it very surprising that there is little or no discussion of cross platform development or data sets,


As John pointed out... apples and oranges. Your data, and everything about presenting it to any app, is on you. CD could care less otherwise.


From the docs 'What Is Core Data":


"Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence."


But as always, for things you'd like to see, feel free to file enhancement requests vis the bug reporter, linked below, adding your report # to your thread for reference, thanks and good luck.

I don't understand what you are talking about. There is no Apple-mandated "Garbage Collection". There is an Apple mandate to not use garbage collection.


It sounds like you are making a lot of assumptions about what Apple is doing and using that as a basis for your own decisions. You don't have access to Apple's internal documentation, private APIs, thousands of engineers, or roadmaps for future changes. You can use transformable attributes in Core Data if you want. But that isn't anything more than NSData, the lowest of low-level data types. But like many such low-level tricks, they get in your way when you want to do something a little fancier like define a new persistence schema that supports both NSBezierPath and UIBezierPath, among other things.

Apparently, you didn't get bit by the Garbage Collection fiasco. Many of us did. You are right that the transform type appears to be simply converting to a NSData blob, which means that that type is serialized and therein lies the problem. You have to know what the data type is in order to deserialize it. If you knew what a NSBezierPath was, you could convert it to a UIBezierPath, and vice-versa. But because each platform is totally oblivious to the other, there is no way to accomplish that seemlingly simple task. There are some rumors about something called "marzipan", but it's obviously not going to be discussed here, so who knows. Just running iOS apps on the Mac is not going to get it. We need a common language and a common data model. The Mac and iOS models as so close, yet so far. We ned to bridge that gap.


If WWDC doesn't produce what we're hoping, we need an alternate plan for doing compatible CoreData managed objects, especially for things such as BezierPaths. In our case, this might require migrating the database to using our CPBezierPath, which we can make sure is properly defined and serialized from basic components on both platforms.


Why this is so important -- Note that Apple, Inc. finally wised-up and introduced a teacher app on Mac to coordinate students' iPads in the classroom, instead of requiring the teacher to use a previously released iPad app for such. I can't get into it all here, but Instructors require far more capabilities than can be achieved with an iPad. Mac is still king here. iOS devices are wonderful data/media consumption products, but mediocre creation/coordination products in comparison to the Mac.

>We need a common language and a common data model.


Again, file an enhancement request via the bug reported - add the report #s or it didn't happen.

When I said I didn't know what you are talking about, I meant that you were rambling and not making any sense. I am aware of Garbage Collection. It is one of many deprecated technologies. I just didn't understand why you were saying that it was mandated to use it.


This is the developer forum. If and when Apple releases any information about this "marzipan" project, it can be discussed here. But until that happens, it is just a rumor.


If you have a solution using a custom class, I strongly suggest that you implement it. Do not wait on Apple. Apple's goals are different than yours.

Well, it may not have been mandated, but it was certainly strongly pushed. My point was that by CoreData providing transform types for NSObjects (plus coding) it made this seem like the thing to do, verses sticking with basic types similar to what could be used in a properties list. As things have evolved, that had become a blind alley for cross platform.


I hadn't really intended to get this deep into it. I was just trying to find out how others have coped with this problem. But I will make a formal enhancement request.