Posts

Post not yet marked as solved
1 Replies
369 Views
Hi, I'm developing a feature for a carrier company, I have to find out whether the iPhone is sim-free (unlocked). How can it be done programmatically? I tried to look at the CTCarrier class but it seems to be deprecated and we cannot count on the information it provides. What would be the right APIs/Classes to use for it? Thanks in advance
Posted
by nca.
Last updated
.
Post not yet marked as solved
3 Replies
981 Views
Hello,I have a max os application that is supposed to copy files into /Library/Application Support folder.I found a piece of code that performs the authorization with authentication and even creates the rights successfully.Right after I try to perform a priviledged operation like creating a directory in /Library/Application Support folder.I get a no permission error 513. How do I use the authorization I created. Seems like my case suits self-restricted application authorization. But I'm missing something there. Will appreciate your help. Here is the code I use to gainAccess:Thanks in advanceprivatefunc gainPermissions() { var authorizationRef: AuthorizationRef? = nil var authItem = AuthorizationItem(name: "xmpie.com.XMPieInstaller.filesRight", valueLength: 0, value: nil, flags: 0) var authRights = AuthorizationRights(count: 1, items: &authItem) let flags: AuthorizationFlags = [.interactionAllowed, .preAuthorize, .extendRights] var authStatus = AuthorizationCreate(&authRights, nil, flags, &authorizationRef) guard let authRef = authorizationRef else { NSLog("Failed to get authorization! \(authStatus) - \(String(authStatus: authStatus))") return } authStatus = AuthorizationCopyRights(authRef, &authRights, nil, flags, nil) NSLog("Auth status #\(authStatus) - \(String(authStatus: authStatus))") let paths = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .localDomainMask, true) if paths.count != 0 { let resolvedPath = paths[0] as NSString let resolvedPath1 = resolvedPath.appendingPathComponent("XMPieTest") do { try FileManager.default.createDirectory(atPath: resolvedPath1, withIntermediateDirectories: true, attributes: nil) } catch let error as NSError { print(error.localizedDescription); }
Posted
by nca.
Last updated
.