Frameworks

RSS for tag

Ask questions about APIs that can drive features in your apps.

Frameworks Documentation

Posts under Frameworks tag

202 Posts
Sort by:
Post not yet marked as solved
5 Replies
4.3k Views
Hi there, I'm working on an app that contains a mini system monitoring utility. I would like to list the top CPU-using processes. As Quinn “The Eskimo!” has repeatedly cautioned, relying on private frameworks is just begging for maintenance effort in the future. Ideally, I want to go through public headers/frameworks. I've gone to great lengths to try to find this information myself, and at this point I'm just struggling. I detail my research below. Any pointers in the right direction would be much appreciated! Attempts Libproc First I looked at libproc. Using proc_pidinfo with PROC_PIDTHREADINFO, I'm able to get each thread of an app, with its associated CPU usage percentage. Summing these, I could get the total for an app. Unfortunately, this has two downsides: Listing a table of processes now takes O(proces_count) rather than just O(process_count), and causes way more syscalls to be made It doesn't work for processes owned by other users. Perhaps running as root could alleviate that, but that would involve making a priviliedged helper akin to the existing sysmond that Activity Monitor.app uses. I'm a little scared of that, because I don't want to put my users at risk. Sysctl Using the keys [CTL_KERN, KERN_PROC, KERN_PROC_PID, someProcessID], I'm able to get a kinfo_proc - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/sysctl.h#L750-L776 instance. Accessing its .kp_proc - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/proc.h#L96-L150.p_pctcpu - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/proc.h#L123 looked really promising, but that value is always zero. Digging deeper, I found the kernel code that fills this struct in (fill_user64_externproc - https://github.com/apple-opensource/xnu/blob/c76cff20e09b8d61688d1c3dfb8cc855cccb93ad/bsd/kern/kern_sysctl.c#L1121-L1168). The assignment of p_pctcpu - https://github.com/apple-opensource/xnu/blob/c76cff20e09b8d61688d1c3dfb8cc855cccb93ad/bsd/kern/kern_sysctl.c#L1149 is in a conditional region, relying on the _PROC_HAS_SCHEDINFO_ flag. Disassembling the kernel on my mac, I could confirm that the assignment of that field never happens (thus _PROC_HAS_SCHEDINFO_ wasn't set during compilation, and the value will always stay zero) Reverse engineering Activity Monitor.app Activity Monitor.app makes proc_info and sysctl system calls, but from looking at the disassembly, it doesn't look like that's where its CPU figures come from. From what I can tell, it's using private functions from /usr/lib/libsysmon.dylib. That's a user library which wraps an XPC connection to sysmond (/usr/libexec/sysmond), allowing you to create requests (sysmon_request_create), add specific attributes you want to retrieve (sysmon_request_add_attribute), and then functions to query that data out (sysmon_row_get_value). Getting the data "striaght from the horses mouth" like this sounds ideal. But unfortunately, the only documentation/usage I can find of sysmond is from bug databases demonstrating a privilege escalation vulnerability lol. There are some partial reverse engineered header files floating around, but they're incomplete, and have the usual fragility/upkeep issues associated with using private APIs. On one hand, I don't want to depend on a private API, because that takes a lot of time to reverse engineer, keep up with changes, etc. On the other, making my own similar privileged helper would be duplicating effort, and expose a bigger attack surface. Needless to say, I have no confidence in being able to make a safer privileged helper than Apple's engineers lol Reverse engineering iStat Menus Looks like they're using proc_pid_rusage - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/libsyscall/wrappers/libproc/libproc.h#L103-L108 . However, I don't know how to convert the cpu_*_time fields of the resulting struct rusage_info_v4 - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/resource.h#L306-L343 to compute a "simple" percentage. Even if I came up with some formula that produces plausible looking results, I have no real guarantee it's correct or equivalent to what Activity Monitor shows.
Posted Last updated
.
Post not yet marked as solved
1 Replies
316 Views
Suppose I have some third party frameworks integrated in an application. From May inwards, its mandatory to have privacy manifest for all the tracking APIs. But if the third party library doesnt have any plans to integrate the third party framework, how should we proceed to avoid rejection from the app store?
Posted Last updated
.
Post marked as solved
4 Replies
353 Views
I have developed a framework for my customer, thats a swift dyanmic framework. For code modularization i have divided this framework features in to multiple static libraries as shown in the diagram below. Currently we have on main swift dynamnic framework and it contains 2 static libraries too. Also the first static library here in turn nested with another static library, Key points to note here is My static libraries contains other third party iOS frameworks My static libraries using CoccoaPods as the dependency for Alarmofire at the moment. My questios are Is there any problem in the current architecture , because i heard nested libraries are not supported in iOS . but since we dont have frameworks nested here, all of our second level frameworks are static libraries only. What are link/libary search path guidance we needed to take care to make a successful build.
Posted
by vishnu_tf.
Last updated
.
Post not yet marked as solved
4 Replies
2.7k Views
Hello, maybe anyone know anything about HCE (Host card emulation) feature on iOS? As far as I read, it's not possible to achieve this functionality on iOS, but maybe there are plans to implement that? Or maybe it's clear that it wont be allowed to be used at all? Thanks:)
Posted
by ViliusSa.
Last updated
.
Post not yet marked as solved
1 Replies
694 Views
Hi, we are currently implementing below method for a quick POC in iOS (Xcode 15.3/macOS Sonoma 14.0): func startQUICConnection() async { // Set the initial stream to bidirectional. options.direction = .bidirectional self.mainConn?.stateUpdateHandler = { [weak self] state in print("Main Connection State: \(state)") switch state { case .ready: print("Ready...") default: break } } // Don't forget to start the connection. self.mainConn?.start(queue: self.queue) } This is what we have in the initializer of the class: parameters = NWParameters(quic: options) mainConn = NWConnection(to: endpoint, using: parameters) These are the class's properties: let endpoint = NWEndpoint.hostPort(host: "0.0.0.0", port: .init(integerLiteral: 6667)) let options = NWProtocolQUIC.Options(alpn: ["echo"]) let queue = DispatchQueue(label: "quic", qos: .userInteractive) var mainConn: NWConnection? = nil let parameters: NWParameters! As per the logs, we never get to the .ready state for the NWConnection. Logs: nw_path_evaluator_create_flow_inner failed NECP_CLIENT_ACTION_ADD_FLOW (null) evaluator parameters: quic, attach protocol listener, attribution: developer, context: Default Network Context (private), proc: 022B7C28-0271-3628-8E5E-26B590B50E5B nw_path_evaluator_create_flow_inner NECP_CLIENT_ACTION_ADD_FLOW 8FEBF750-979D-437F-B4A8-FB71F4C5A882 [22: Invalid argument] nw_endpoint_flow_setup_channel [C2 0.0.0.0:6667 in_progress channel-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, ipv6, dns, uses wifi)] failed to request add nexus flow Main Connection State: preparing Main Connection State: waiting(POSIXErrorCode(rawValue: 22): Invalid argument) We're running a local server using proxygen on port 6667. It connects with the proxygen client though... Have tried several thing but results are the same.
Posted
by palfonso.
Last updated
.
Post not yet marked as solved
0 Replies
560 Views
When distributing a 3rd party SDK as an XCFramework in order to include the privacy manifest to the bundle you need to include the resources key in the target configuration to point to the correct file, for example: resources: [.process("Resources/PrivacyInfo.xcprivacy")] However, when distributing the xcframework as a binaryTarget resources is not available. How can I include my privacy manifest when configuring Package.swift ?
Posted
by moshekr.
Last updated
.
Post not yet marked as solved
0 Replies
311 Views
In https://developer.apple.com/support/third-party-SDK-requirements/ it says "Signatures are also required in these cases where the listed SDKs are used as binary dependencies. " As I am clueless regarding the technicalities of how sdks are added to a host app, the term binary dependency means nothing to me. For reference, our app uses Cocoapods to install all of the sdks.
Posted Last updated
.
Post not yet marked as solved
1 Replies
299 Views
Prepared archive for validation Validation failed error: Asset validation failed Missing Bundle Identifier. The application bundle contains a tool or framework [aaa.bbb.ccc.ddd.pkg/Payload/my.app/Contents/Frameworks/Abc.framework] that is missing the bundle identifier in its Info.plist file. (ID: 8d117580-6d15-4b9e-8a0c-3bd069c66c77) error: Asset validation failed Bad Bundle Executable. You must include a valid CFBundleExecutable key in the nested bundle [aaa.bbb.ccc.ddd.pkg/Payload/shudou.app/Contents/Frameworks/Abc.framework] property list file. (ID: 62894f06-c782-4d67-85df-91912d1b6609) Abc.framwork is a pre-built lib used in swift. I put following keys in Abc.xcframework's Info.plist, but no effect. <key>CFBundleIdentifier</key> <string>aaa.bbb.ccc.ddd.Libname</string> <key>CFBundleExecutable</key> <string>Libname</string>
Posted Last updated
.
Post not yet marked as solved
1 Replies
276 Views
我想用Network.framework中path_monitor来监听网络状态的变化,在Network.framework的interface.h中有一个枚举定义nw_interface_radio_type_t,我没有找到关于它的使用方法。 I want to use path_monitor in Network.framework to monitor changes in network status. There is an enumeration definition nw_interface_radio_type_t in interface.h of Network.framework. I have not found how to use it.
Posted Last updated
.
Post not yet marked as solved
1 Replies
586 Views
While building xcode is giving me the **** error Cannot load module '***' built with SDK 'iphoneos16.4' when using SDK 'iphoneos17.0': /Users/***/Library/Developer/Xcode/DerivedData/project-biopprgumksoaqgnrhztiivzzjkq/Build/Products/Debug-iphoneos/Turf.framework/Modules/Turf.swiftmodule/arm64-apple-ios.swiftmodule It's working fine on xcode 14.3 but giving error on xcode 15
Posted Last updated
.
Post not yet marked as solved
1 Replies
272 Views
We use CocoaPods to manage third-party SDKs, so how should we sign and use these third-party SDKs
Posted
by mqyu.
Last updated
.
Post not yet marked as solved
0 Replies
182 Views
I am creating a project with Flutter, but in the Runner/Frameworks folder, all files such as Pods_Runner.framework etc. are red and the file is not located in the specified folder. The same situation exists in my old projects. I don't know where I'm doing wrong, it was normal until a few days ago, but now even if I create a new project, I get the same error. Flutter Version: 3.13.9 Cocoapods Version: 1.15.2 XCode: 15.1
Posted Last updated
.
Post not yet marked as solved
1 Replies
356 Views
Why not give devs pvt file bundle, with only image and video, it's not live photo!!! I can't use the quick look framework to preview it, and I also can't share to another app as live photo example: save it back to photos or share it by iMessage 🙄 . I can't understand this design, why not any detail? Another thing is so bad, the music data type has no store ID for musickit play item, so the Apple Journal app can play the music, but other apps can't do it! The live photo is the same. What are you doing Apple?
Posted
by lcrystal.
Last updated
.
Post not yet marked as solved
1 Replies
166 Views
With Xcode 15.3, iOS SDK 17.4, in a iOS App, I have this error : TestClass.swift:11:27: error: cannot find 'CLBeaconIdentityCondition' in scope let beaconCondition = CLBeaconIdentityCondition(uuid: UUID(uuidString: "12345678-1234-1234-1234-123456789012"), major: 1, minor: 2) I can reproduce with this swift code : import CoreLocation class TestClass: NSObject{ let beaconCondition = CLBeaconIdentityCondition(uuid: UUID(uuidString: "12345678-1234-1234-1234-123456789012"), major: 1, minor: 2) } And this compilation command : xcrun swiftc -target arm64-apple-ios17.4 -sdk $(xcrun --sdk iphoneos --show-sdk-path) -emit-executable TestClass.swift -o TestClassExecutable -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -framework CoreLocation
Posted
by bdp.
Last updated
.
Post not yet marked as solved
0 Replies
140 Views
0 In other frameworks, I've seen codeSignature included in dynamic cases. because dynamic frameworks have "embed and sign" option. but this time Apple said, "Signatures are so required in these cases where the listed SDKs are used as binary dependencies." Does that mean that even if the ".framework" file of the SDK you are deploying is static, you have to include codeSignature? and if a framework is not included in Privacy-Impacting SDKs list, is it okay not to sign?
Posted
by asdfffaaa.
Last updated
.
Post not yet marked as solved
5 Replies
507 Views
this post is related to the https://developer.apple.com/videos/play/wwdc2023/10061/ Hi, we are wondering if the framework should be signed. the video indicates that all xcframework must be signed, on the other hand framework is not mentioned even website. does anyone have ideas?
Posted
by Gazzy.
Last updated
.
Post not yet marked as solved
1 Replies
403 Views
The current structure of my SDK xcframework is XXXX-Release.xcframework. Inside that, I have an XXXX.xcframework and a LICENSE.md file. Currently, this structure works fine in Swift Package Manager, dropping the XXXX-Release.xcframework file into Xcode and CocoaPods. When I sign my xcframework as per Apple's requirements, I need to sign XXXX.xcframework, which is on the second level. Signing this works fine. Will this meet Apple's requirements for signing an xcframework? I just want to make sure the current structure of my SDK does not need to change. Thanks
Posted
by ajeisses.
Last updated
.
Post not yet marked as solved
4 Replies
1.8k Views
Hello. We provide our software in the form of static libraries (.a) wrapped in xcframework. Therefore, the final app will not include the embed framework. In such a case, should the manifest content required for the library be written as part of the application's xcprivacy file? Or can I provide xcprivacy as part of the xcframework?
Posted Last updated
.
Post not yet marked as solved
6 Replies
873 Views
To download files, we have two NSURLSession objects. One configured for foreground downloads and one for background downloads. Initially, we download user-requested files in the foreground using downloadTaskWithRequest, because foreground downloads are faster than background downloads. We then also start a background task for each download using beginBackgroundTaskWithName:expirationHandler:. This background task's expiration handler starts a background download if the download didn't complete in the foreground. It cancels the foreground download with resume data using cancelByProducingResumeData. A background download task is then started using downloadTaskWithResumeData. Now, testing has shown that background download tasks resume correctly (the urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:) callback is called by iOS) if the background task is started immediately. However, iOS can decide to start these background download tasks later. As a sidenote, the isDiscretionary property of our background download session is set to the default, which should be false. The issue we have is that background downloads that are resumed several minutes (6,5 minutes in the session I'm currently looking at) after their original foreground download was cancelled, are not resumed properly. They download the remaining part of the file, but the first part that was downloaded in the foreground is lost. What could have happened? Perhaps the temporary file has been deleted in the meantime? Is there some way to maintain this file or detect this case?
Posted
by p_b_omta.
Last updated
.