Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Reply to KVO and XIB file madness
>> It is weak because if it were strong, a retain cycle would ensueTo reiterate:1. It is a bug to make it weak (because that leads to a crash, which is the horse you rode in on).2. It is a bug to make it strong without a mechanism to nil out the relationship when the window is closing (because that leads to a retain cycle).3. A better design would be to make it neither strong nor weak. I mean, remove knowledge of the window controller from the plugin system. agent.weatherProperties sounds like pure data model to me, so the MVC relationship you want is model.agent.weatherProperties, not controller.agent.weatherProperties.Another way of putting is, instead of the window controller passing self into your plugin system, it should pass self.model, where model is a custom object that has all of the properties needed by plugins that are currently accessed via the window controller.Although controller vs. model may seem like a distinction without a difference, the point is that exposing the wi
Topic: UI Frameworks SubTopic: AppKit Tags:
Jul ’16
Error "Segues must have an identifier"
My app runs fine but I've got a warning in Xcode 7.3.1 that says:Segues initiated directly from view controllers must have an identifierOn my storyboard and also in my code all segues have identifiersIf I double click it takes me to the end of the source code for the view controller. There is no mention of segue there..If I search the source code the only segue I see without an identifier is on the root view controller… Any Ideas?Thanks!<scene sceneID=9W3-l5-iKf> <objects> <navigationController automaticallyAdjustsScrollViewInsets=NO id=CIC-k8-VJ6 sceneMemberID=viewController> <toolbarItems/> <navigationBar key=navigationBar contentMode=scaleToFill id=fS8-Bl-fda> <rect key=frame x=0.0 y=0.0 width=320 height=44/> <autoresizingMask key=autoresizingMask/> </navigationBar> <nil name=viewControllers/> <connections> <segue destination=BYZ-38-t0r kind=relationship relationship=rootViewController id=3Fr-zs-F5x/> </connections> &
1
0
565
Jul ’16
Reply to Complication help please...
#1: It shows dashes when it doesn't have real or placeholder data yet; those are the cases where you get the Complication Asset images for the other variants, but AFAICT there's no place to set an equivalent friendlier large complication default. I'll probably request that in Radar; the dashes annoy me.Customize uses the getPlaceholderTemplateForComplication. Are you returning the same thing for that and the real ones? Is your image marked as being a template image? There's a Render as popup in the IB inspector.- ETA: it only shows the placeholder in the customize screen. If you have data, then you're missing something that tells the watch to show it. But if it really is a case of no data, then to get rid of the dashes, you need to return a start/end date for that complication - I used the earliest/latestTimeTravelDates because I don't want it to ever gray out - and have getCurrentTimelineEntryForComplication return something useful. The before/after callbacks can return nil. You could reuse the placeholder t
Topic: App & System Services SubTopic: General Tags:
Jul ’16
Reply to Why are ordered to-many relationships generated as OrderedSet?
Not only is Xcode's code generator garbage, but if you correct your relationship types to NSMutableOrderedSet (and probably also NSMutableSet) —your inverse relationships will no long get updated automatically as you add or remove objects in that set! This is absolutely insane. It literally cripples my app and affects hundreds of lines of code. Not a happy customer tonight... Is anyone at Apple even testing this in a Core Data app?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’16
Reply to Core Data iOS 10: Codegen and methods
Hey @sftp, this feature is not usable in Beta 3. It does not work as advertised and is not a viable replacement for mogenerator.Specifically, no matter which codegen option you pick, you'll get a +CoreDataClass.swift file in addition to a +CoreDataProperties.swift file.The +CoreDataClass.swift file is useless because the name isn't simply the name of your class, and if you're migrating to Xcode 8 + Swift 3 you typically already have class files that were generated by mogenerator (which of course no longer works).The files are missing generated string constants like the Attributes and Relationships enums provided by mogenerator. These enums/structures are needed for safer KVC.Worse, sets are not properly typed.Far worse than that, ordered to-many relationships are not generated properly. There are no accessor methods like in mogenerator. These relationships are spit out as OrderedSet—which are not mutable. They need to be NSMutableOrderedSet or somesuch. If something gets dumped into
Jul ’16
Reply to Core Data iOS 10: Codegen and methods
Thank you for your feedback.There is a known issue in the seed where navigating away from the model file causes changes to be discarded. This is especially confusing when making changes in the inspector, and is the most common cause of a class file continuing to be generated after changing the code generation type to `Category/Extension`. An explicit ⌘S (and ⌘B) immediately after changing the codegen type should work around the issue until it is fixed.The string enums mogenerator produces are convenient, but it is not possible for the compiler to reason about them. I've filed <rdar://problem/27554613> on your behalf on the topic of emitting something like this in Objective-C, but Swift code should use the #keypath() expression, a more general solution which is always checked for validity at compile-time.The types that are generated by Xcode for relationships were not chosen arbitrarily. Manually changing the types is not supported. There are serious performance implications for types that seem
Jul ’16
call for feedback
7/26/2016: https://developer.apple.com/app-store/review/guidelines/#other-business-model-issues......3.1 Payments 3.1.1 In-App Purchase: If you want to unlock features or functionality within your app, (by way of example: subscriptions, in-game currencies, game levels, ...Apps distributed via the Mac App Store may host plug-ins or extensions that are enabled with mechanisms other than the App Store. 3.1.2 Subscriptions: Auto-renewing subscriptions should only be offered using in-app purchase and may only be used for periodicals (e.g. newspapers, ...the app is available. You may offer subscriptions that are shared across your own apps, but these subscriptions may not extend to third party apps or services.Note: We will update these guidelines in the coming weeks for the subscription changes launching this fall._____________________________________I have the following Mac App Store questions:I want to start selling a new productivity product today that can best transition to a subscription model in the future?F
11
0
575
Jul ’16
I've wondering a no cross-zone relationships.
HI. I've wondering that the CustomZone, no cross-zone relationships has told in Advanced Cloudkit session wwdc'14. but in the situation ,Place ( CKRecord ) in defaultZone, public database or in defaultZone , private databaseand Note (CKRecord ) has a back reference relationship with place id on customZone , private database.is it ok ? I am confusing for myself because Note has relationship with Place about cross-zone (defaultZone in public or private )so is it not good ?and there're another question. Can CKRecordZone have a different-recordtype CKRecord all-in-one?firstly, I think CKRecordZone is like a table (rdbs). so can only have same recordtype. but I think that's not true. so when you create customzone , if one to many modeling data, you can save place , note record in same recordzone. and then also get a atomic-commit function. am I right ?
0
0
292
Jul ’16
Reply to IOS OpenVPN Library and NEFramework integration
1) We try to use this code for set the VPN configuration…How must be the server address format ?That address is interpreted by your code (the NEPacketTunnelProvider subclass in your extension). As such, it’s up to you how to format it. Most folks use a DNS name or IP address, but I don’t think there’s anything in the system that requires it to be formatted that way when you’re creating a custom VPN transport.I recently wrote up a discussion of how settings flow through the system when you’re creating a custom VPN transport as part of a DTS incident (s. 644618748). I’ve pasted it in below because I think you’ll find it useful.2) How exactly use the NEPacketTunnelProvider extension added in our App ?…But how can we use the class declared in the app extensions ?When you start the VPN connection (by calling methods on the NETunnelProviderSession instance you get via the connection property of the NETunnelProviderManager), the system starts your extension process, instantiates your NEPacketTunnelProvider subclass
Jul ’16
Returning a pointer-to-member function under a certain condition is not work
I found that returning a pointer-to-member function under a certain condition, is not work as I expected.It happens on a very specific situation: on armv7, with compiler optimization level -Os.Along with other platforms like arm64, simulators, x86_64, and other optim-level from -O0 to -Ofast, the code is work.Tested on Xcode 7.3, 7.3.1, and 8 beta.(I don't remember the exact Xcode version, but anyway on older Xcode the code works well.)The code is somewhat complex, although I've tried my best to narrow down it to find and reproduce the problem.#include <iostream> class Base { public: Base() {} virtual ~Base() {} }; #define ToFuncPtr(FN) static_cast<FuncPtr>(&FN) typedef void (Base::*FuncPtr)(int arg); class Interface { public: virtual ~Interface() {} virtual FuncPtr getFuncPtr() = 0; }; class Derived : public Base , public Interface { public: Derived() {} virtual ~Derived() {} void test() { Interface * pI = dynamic_cast<Interface *>(this); FuncPtr f = pI->getFuncPtr(); std::cout <&
0
0
366
Jul ’16
Reply to Swift NSOutputStream not outputting full base64 string
You’re not using NSStream correctly. NSStream supports two modes of operation:async, via the -stream:handleEvent: callback scheduled on a run loop (-scheduleInRunLoop:forMode:) or a dispatch queue (CF{Read,Write}StreamSetDispatchQueue)sync, the defaultMost folks use it async but it’s OK to use it sync under specific circumstances (more on this below). I’m going to assume that’s true in your case and take things from there.Which brings us to this code:var readByte :UInt8 = 0 while inputStream.hasBytesAvailable { inputStream.read(&readByte, maxLength: 1) }This is definitely wrong. You’re mixing up the notion of whether bytes are available (hasBytesAvailable) with the notion of whether the stream has hit EOF (that is, no more bytes can become available). These are different things. The correct approach depends on how your data is structured on the ‘wire’:If the remote peer sends you data and then closes its end of the TCP connection, you can use EOF to denote the end of your data.If not, then the data stream
Aug ’16
Reply to Can we disable the NSStream bytes/space available callbacks using CFSocketDisableCallbacks() on NSStream underling socket?
Now is there any way we can disable NSStream read/space callbacks and enable it again as this is possible with CFSocket.Not really. You could try unscheduling the stream but that’d put you well off the beaten path.I tried to get the underlying socket of the NSStream … and tried to call CFSocketDisableCallbacks on it but it did not disable the bytes/space available callbacks. CFSocketStream does not necessarily use CFSocket. There used to be a direct relationship back in the day but things have moved on a lot since then.The reason behing this is I do not want to keep buffer for storing the read bytes from NSInputStream and the consumer for those bytes is asynchronous.I’m not sure I understand your requirements, but it sounds like you can simply stop responding to .HasBytesAvailable messages. When you use NSStream in async mode, I/O is based on an ‘interlock’ mechanism: you get a .HasBytesAvailable eventyou make a read(_:maxLength:) callyou get another .HasBytesAvailable eventSimilarly for .HasSpaceAva
Aug ’16
Reply to How embed sqlite3 binary into my app?
Does your app use the sqlite3 tool directly (sublaunching it via NSTask, for example)? If so, you should sandbox the tool and set the com.apple.security.inherit entitlement. That will cause the tool to inherit its entitlements from your app, which is probably what the want and will make App Review happy. The only fly in that ointment is if you also want the user to be able to run the sqlite3 tool from Terminal. In that case com.apple.security.inherit causes problems because there’s no app sandbox to inherit from. If that’s the case, please post back explaining the expected use cases for this sqlite3 tool. Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Code Signing SubTopic: General Tags:
Aug ’16
Reply to KVO and XIB file madness
>> It is weak because if it were strong, a retain cycle would ensueTo reiterate:1. It is a bug to make it weak (because that leads to a crash, which is the horse you rode in on).2. It is a bug to make it strong without a mechanism to nil out the relationship when the window is closing (because that leads to a retain cycle).3. A better design would be to make it neither strong nor weak. I mean, remove knowledge of the window controller from the plugin system. agent.weatherProperties sounds like pure data model to me, so the MVC relationship you want is model.agent.weatherProperties, not controller.agent.weatherProperties.Another way of putting is, instead of the window controller passing self into your plugin system, it should pass self.model, where model is a custom object that has all of the properties needed by plugins that are currently accessed via the window controller.Although controller vs. model may seem like a distinction without a difference, the point is that exposing the wi
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jul ’16
Error "Segues must have an identifier"
My app runs fine but I've got a warning in Xcode 7.3.1 that says:Segues initiated directly from view controllers must have an identifierOn my storyboard and also in my code all segues have identifiersIf I double click it takes me to the end of the source code for the view controller. There is no mention of segue there..If I search the source code the only segue I see without an identifier is on the root view controller… Any Ideas?Thanks!<scene sceneID=9W3-l5-iKf> <objects> <navigationController automaticallyAdjustsScrollViewInsets=NO id=CIC-k8-VJ6 sceneMemberID=viewController> <toolbarItems/> <navigationBar key=navigationBar contentMode=scaleToFill id=fS8-Bl-fda> <rect key=frame x=0.0 y=0.0 width=320 height=44/> <autoresizingMask key=autoresizingMask/> </navigationBar> <nil name=viewControllers/> <connections> <segue destination=BYZ-38-t0r kind=relationship relationship=rootViewController id=3Fr-zs-F5x/> </connections> &
Replies
1
Boosts
0
Views
565
Activity
Jul ’16
Reply to Complication help please...
#1: It shows dashes when it doesn't have real or placeholder data yet; those are the cases where you get the Complication Asset images for the other variants, but AFAICT there's no place to set an equivalent friendlier large complication default. I'll probably request that in Radar; the dashes annoy me.Customize uses the getPlaceholderTemplateForComplication. Are you returning the same thing for that and the real ones? Is your image marked as being a template image? There's a Render as popup in the IB inspector.- ETA: it only shows the placeholder in the customize screen. If you have data, then you're missing something that tells the watch to show it. But if it really is a case of no data, then to get rid of the dashes, you need to return a start/end date for that complication - I used the earliest/latestTimeTravelDates because I don't want it to ever gray out - and have getCurrentTimelineEntryForComplication return something useful. The before/after callbacks can return nil. You could reuse the placeholder t
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’16
Why are ordered to-many relationships generated as OrderedSet?
When you use the Create NSMangledObject subclass feature in In Xcode 8 and Swift 3, any ordered to-many relationships are generated as OrderedSet. They should be NSMutableOrderedSet, as was handled properly by mogenerator.Apple: Please explain. Surely we need to be able to modify those relationships without being forced to make wholesale changes.
Replies
4
Boosts
0
Views
439
Activity
Jul ’16
Reply to Why are ordered to-many relationships generated as OrderedSet?
Not only is Xcode's code generator garbage, but if you correct your relationship types to NSMutableOrderedSet (and probably also NSMutableSet) —your inverse relationships will no long get updated automatically as you add or remove objects in that set! This is absolutely insane. It literally cripples my app and affects hundreds of lines of code. Not a happy customer tonight... Is anyone at Apple even testing this in a Core Data app?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’16
Reply to Core Data iOS 10: Codegen and methods
Hey @sftp, this feature is not usable in Beta 3. It does not work as advertised and is not a viable replacement for mogenerator.Specifically, no matter which codegen option you pick, you'll get a +CoreDataClass.swift file in addition to a +CoreDataProperties.swift file.The +CoreDataClass.swift file is useless because the name isn't simply the name of your class, and if you're migrating to Xcode 8 + Swift 3 you typically already have class files that were generated by mogenerator (which of course no longer works).The files are missing generated string constants like the Attributes and Relationships enums provided by mogenerator. These enums/structures are needed for safer KVC.Worse, sets are not properly typed.Far worse than that, ordered to-many relationships are not generated properly. There are no accessor methods like in mogenerator. These relationships are spit out as OrderedSet—which are not mutable. They need to be NSMutableOrderedSet or somesuch. If something gets dumped into
Replies
Boosts
Views
Activity
Jul ’16
Reply to Core Data iOS 10: Codegen and methods
Thank you for your feedback.There is a known issue in the seed where navigating away from the model file causes changes to be discarded. This is especially confusing when making changes in the inspector, and is the most common cause of a class file continuing to be generated after changing the code generation type to `Category/Extension`. An explicit ⌘S (and ⌘B) immediately after changing the codegen type should work around the issue until it is fixed.The string enums mogenerator produces are convenient, but it is not possible for the compiler to reason about them. I've filed <rdar://problem/27554613> on your behalf on the topic of emitting something like this in Objective-C, but Swift code should use the #keypath() expression, a more general solution which is always checked for validity at compile-time.The types that are generated by Xcode for relationships were not chosen arbitrarily. Manually changing the types is not supported. There are serious performance implications for types that seem
Replies
Boosts
Views
Activity
Jul ’16
call for feedback
7/26/2016: https://developer.apple.com/app-store/review/guidelines/#other-business-model-issues......3.1 Payments 3.1.1 In-App Purchase: If you want to unlock features or functionality within your app, (by way of example: subscriptions, in-game currencies, game levels, ...Apps distributed via the Mac App Store may host plug-ins or extensions that are enabled with mechanisms other than the App Store. 3.1.2 Subscriptions: Auto-renewing subscriptions should only be offered using in-app purchase and may only be used for periodicals (e.g. newspapers, ...the app is available. You may offer subscriptions that are shared across your own apps, but these subscriptions may not extend to third party apps or services.Note: We will update these guidelines in the coming weeks for the subscription changes launching this fall._____________________________________I have the following Mac App Store questions:I want to start selling a new productivity product today that can best transition to a subscription model in the future?F
Replies
11
Boosts
0
Views
575
Activity
Jul ’16
I've wondering a no cross-zone relationships.
HI. I've wondering that the CustomZone, no cross-zone relationships has told in Advanced Cloudkit session wwdc'14. but in the situation ,Place ( CKRecord ) in defaultZone, public database or in defaultZone , private databaseand Note (CKRecord ) has a back reference relationship with place id on customZone , private database.is it ok ? I am confusing for myself because Note has relationship with Place about cross-zone (defaultZone in public or private )so is it not good ?and there're another question. Can CKRecordZone have a different-recordtype CKRecord all-in-one?firstly, I think CKRecordZone is like a table (rdbs). so can only have same recordtype. but I think that's not true. so when you create customzone , if one to many modeling data, you can save place , note record in same recordzone. and then also get a atomic-commit function. am I right ?
Replies
0
Boosts
0
Views
292
Activity
Jul ’16
Reply to IOS OpenVPN Library and NEFramework integration
1) We try to use this code for set the VPN configuration…How must be the server address format ?That address is interpreted by your code (the NEPacketTunnelProvider subclass in your extension). As such, it’s up to you how to format it. Most folks use a DNS name or IP address, but I don’t think there’s anything in the system that requires it to be formatted that way when you’re creating a custom VPN transport.I recently wrote up a discussion of how settings flow through the system when you’re creating a custom VPN transport as part of a DTS incident (s. 644618748). I’ve pasted it in below because I think you’ll find it useful.2) How exactly use the NEPacketTunnelProvider extension added in our App ?…But how can we use the class declared in the app extensions ?When you start the VPN connection (by calling methods on the NETunnelProviderSession instance you get via the connection property of the NETunnelProviderManager), the system starts your extension process, instantiates your NEPacketTunnelProvider subclass
Replies
Boosts
Views
Activity
Jul ’16
Returning a pointer-to-member function under a certain condition is not work
I found that returning a pointer-to-member function under a certain condition, is not work as I expected.It happens on a very specific situation: on armv7, with compiler optimization level -Os.Along with other platforms like arm64, simulators, x86_64, and other optim-level from -O0 to -Ofast, the code is work.Tested on Xcode 7.3, 7.3.1, and 8 beta.(I don't remember the exact Xcode version, but anyway on older Xcode the code works well.)The code is somewhat complex, although I've tried my best to narrow down it to find and reproduce the problem.#include <iostream> class Base { public: Base() {} virtual ~Base() {} }; #define ToFuncPtr(FN) static_cast<FuncPtr>(&FN) typedef void (Base::*FuncPtr)(int arg); class Interface { public: virtual ~Interface() {} virtual FuncPtr getFuncPtr() = 0; }; class Derived : public Base , public Interface { public: Derived() {} virtual ~Derived() {} void test() { Interface * pI = dynamic_cast<Interface *>(this); FuncPtr f = pI->getFuncPtr(); std::cout <&
Replies
0
Boosts
0
Views
366
Activity
Jul ’16
Reply to Swift NSOutputStream not outputting full base64 string
You’re not using NSStream correctly. NSStream supports two modes of operation:async, via the -stream:handleEvent: callback scheduled on a run loop (-scheduleInRunLoop:forMode:) or a dispatch queue (CF{Read,Write}StreamSetDispatchQueue)sync, the defaultMost folks use it async but it’s OK to use it sync under specific circumstances (more on this below). I’m going to assume that’s true in your case and take things from there.Which brings us to this code:var readByte :UInt8 = 0 while inputStream.hasBytesAvailable { inputStream.read(&readByte, maxLength: 1) }This is definitely wrong. You’re mixing up the notion of whether bytes are available (hasBytesAvailable) with the notion of whether the stream has hit EOF (that is, no more bytes can become available). These are different things. The correct approach depends on how your data is structured on the ‘wire’:If the remote peer sends you data and then closes its end of the TCP connection, you can use EOF to denote the end of your data.If not, then the data stream
Replies
Boosts
Views
Activity
Aug ’16
Reply to Can we disable the NSStream bytes/space available callbacks using CFSocketDisableCallbacks() on NSStream underling socket?
Now is there any way we can disable NSStream read/space callbacks and enable it again as this is possible with CFSocket.Not really. You could try unscheduling the stream but that’d put you well off the beaten path.I tried to get the underlying socket of the NSStream … and tried to call CFSocketDisableCallbacks on it but it did not disable the bytes/space available callbacks. CFSocketStream does not necessarily use CFSocket. There used to be a direct relationship back in the day but things have moved on a lot since then.The reason behing this is I do not want to keep buffer for storing the read bytes from NSInputStream and the consumer for those bytes is asynchronous.I’m not sure I understand your requirements, but it sounds like you can simply stop responding to .HasBytesAvailable messages. When you use NSStream in async mode, I/O is based on an ‘interlock’ mechanism: you get a .HasBytesAvailable eventyou make a read(_:maxLength:) callyou get another .HasBytesAvailable eventSimilarly for .HasSpaceAva
Replies
Boosts
Views
Activity
Aug ’16
Reply to How embed sqlite3 binary into my app?
Does your app use the sqlite3 tool directly (sublaunching it via NSTask, for example)? If so, you should sandbox the tool and set the com.apple.security.inherit entitlement. That will cause the tool to inherit its entitlements from your app, which is probably what the want and will make App Review happy. The only fly in that ointment is if you also want the user to be able to run the sqlite3 tool from Terminal. In that case com.apple.security.inherit causes problems because there’s no app sandbox to inherit from. If that’s the case, please post back explaining the expected use cases for this sqlite3 tool. Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’16
Reply to Xcode 8 beta 4 - Crash when code generating CoreData objects
In my case crashes seem to be caused by to-one relationships.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’16