Xpc target api for microsoft .net framework
If the class overrides its initWithCoder: method, when decoding any instance variable, property, or other value that contains an object of a non-collection class including custom classes always use decodeObjectOfClass:forKey: to ensure that the data is of the expected type. Decode collection classes safely. Any non-collection class that contains instances of collection classes must override the initWithCoder: method.
In that method, when decoding the collection object or objects, always use decodeObjectOfClasses:forKey: and provide a list of any objects that can appear within the collection. When generating the list of classes to allow within a decoded collection class, you should be aware of two things.
First, Apple collection classes are not automatically whitelisted by the decodeObjectOfClasses:forKey: method, so you must include them explicitly in the array of class types.
Second, you should list only classes that are direct members of the collection object graph that you are decoding without any intervening non-collection classes. For example, if you have an array of dictionaries, and one of those dictionaries might contain an instance of a custom class called OuterClass , and OuterClass has an instance variable of type InnerClass, you must include OuterClass in the list of classes because it is a direct member of the collection tree.
However, you do not need to list InnerClass because there is a non-collection object between it and the collection tree. Figure shows some examples of when whitelisting is required and shows when classes must provide overridden initWithCoder : methods. However, when a method specifies a collection class NSArray , NSDictionary , and so on as the parameter type, the compiler has no way to determine what classes should be allowed to appear within that container. For this reason, if your methods take collection class instances as parameters, you must explicitly whitelist any classes that can appear within those containers.
For every method in your interface that takes a collection class as a parameter, you must determine what classes should be allowed as members. You should whitelist only classes that can be members of any top-level collection objects. If you whitelist classes at the top level unnecessarily, those objects are allowed to appear within the top-level collection objects, which is not what you want. In particular:. Apple-provided classes that support property list serialization such as other collection classes are automatically whitelisted for you.
It is never necessary to whitelist these classes at the top level. For the most up-to-date list of classes supported by property list serialization, read Serializing Property Lists in Archives and Serializations Programming Guide.
If the enclosing class correctly conforms to NSSecureCoding , such whitelisting is not required. Assuming the pommesFrites array is an array of FrenchFry objects as the name implies , you would whitelist the array of FrenchFry objects as follows:.
In this case, the value NO is passed for the ofReply parameter because this code is modifying the whitelist for one of the parameters of the method itself. Most of the time, it makes sense to copy objects and send them to the other side of a connection. Passing objects by copying is the most straightforward way to use NSXPC, and should be used wherever possible. If you need to share a single instance of the data between the client application and the helper, you must pass the objects by proxy.
If an object needs to call methods on other objects within your application that you cannot or do not wish to pass across the connection such as user interface objects , then you must pass an object by proxy—either the caller, the callee where possible , or a relay object that you construct specifically for that purpose.
The downside to passing objects by proxy is that performance is significantly reduced because every access to the object requires interprocess communication. For this reason, you should pass objects by proxy only if it is not possible to pass them by copying. You can configure additional proxy objects similarly to the way you configured the remoteObjectInterface property of the initial connection. First, identify which parameter to a method should be passed by proxy, then specify an NSXPCInterface object that defines the interface for that object.
If you want to pass the first parameter to that method by proxy, you would configure the interface like this:. When you send the first message, the launchd daemon searches your application bundle for a service bundle whose CFBundleIdentifier value matches the specified name, then launches that XPC service daemon on demand.
The event handler function runs on a queue whose name is the name of the XPC service. If a reply was sent by the service, the handler associated with the previous message is called upon receiving the reply. The reply can be put on a different queue than the one used for incoming messages. No serial relationship is guaranteed between reply messages and non-reply messages. All suspend calls must be balanced with resume calls. NET 6 applications, you can target Windows Nano Server, which is cloud optimized, uses Kestrel and is smaller and starts faster.
You can also target Linux, supporting Debian, Alpine, and others. Also uses Kestrel, is smaller, and starts faster. You can also create your own Docker image in cases where you want to use a different Linux distro or where you want an image with versions not provided by Microsoft. For example, you might create an image with ASP. NET Core running on the traditional. When you add the image name to your Dockerfile file, you can select the operating system and version depending on the tag you use, as in the following examples:.
Previous Next. Skip to main content. Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services.
Privacy policy. In Visual Studio, you can specify the version of. NET that you want your project to target. Framework targeting helps guarantee that the application uses only functionality that is available in the specified framework version.
NET Framework apps to run on another computer, the framework version that the application targets must be compatible with the framework version that's installed on the computer. A Visual Studio solution can contain projects that target different versions of.
However, note that you can only build against a single version of. NET either using reference conditionals for a single build or recursively build different binaries for each version. For more information about target frameworks, see Target frameworks. You can also target applications for different platforms.
For more information, see Multitargeting. When you open a project that targets an earlier framework version, Visual Studio can automatically upgrade the project or leave the target as-is.
When you create a. NET Framework project, you can specify the version of the. NET Framework that you want to target. You can target multiple frameworks in a single project. When you change the version of. NET that a project targets, Visual Studio makes any required changes to references and configuration files.
NET Standard 2. NET 5 or later apps can use a netstandard2. Explicitly targeting net5. NET Standard 1. NET implementations support. You should only target. All platforms supporting. App model specific APIs will not be available in.
Sometimes you need to access framework-specific APIs from your libraries. The best way to call framework-specific APIs is using multi-targeting, which builds your project for many.
NET target frameworks rather than for just one. To shield your consumers from having to build for individual frameworks, you should strive to have a.
NET Standard output plus one or more framework-specific outputs. With multi-targeting, all assemblies are packaged inside a single NuGet package. Consumers can then reference the same package and NuGet will pick the appropriate implementation.
0コメント