How to check the “Allow Full Access” is enabled in iOS 8?

后端 未结 15 1190
醉酒成梦
醉酒成梦 2020-12-02 07:53

In iOS 8, when develop a custom keyboard and set RequestsOpenAccess property to YES in info.plist, there is a toggle button at Settings-> Add New Keyboard named \"Allow Full

相关标签:
15条回答
  • 2020-12-02 08:06

    This code works for me, I also on App Groups : https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW61

    May be it will work without App Groups also.

    And I used this code :

    if(isOpenAccessGranted()){ 
                NSLog("FULL ACCESS ON")                
            }
            else{
                NSLog("FULL ACCESS OFF")               
            }
    }
    
    func isOpenAccessGranted() -> Bool {
            return UIPasteboard.generalPasteboard().isKindOfClass(UIPasteboard)
    }
    
    0 讨论(0)
  • 2020-12-02 08:06

    just use

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),     
    ^{
        AudioServicesPlaySystemSound(1104);
        });
    

    the tirck is ,when the full access is enabled ,the sound will play ,if not ,because it's call is in the background thread will no block the main thread

    0 讨论(0)
  • 2020-12-02 08:07

    Apps with app group can use :

     func isOpenAccessGranted() -> Bool {
        let fm = NSFileManager.defaultManager()
        let containerPath = fm.containerURLForSecurityApplicationGroupIdentifier(
            AppGroup)?.path
        return fm.isWritableFileAtPath(containerPath!)
    }
    
    0 讨论(0)
  • 2020-12-02 08:09

    Useful Swift solution by @hoiberg42:

    func isOpenAccessGranted() -> Bool {
        return UIPasteboard.generalPasteboard().isKindOfClass(UIPasteboard)
    }
    

    Works like a charm!

    0 讨论(0)
  • 2020-12-02 08:09

    Today, for iOS 9.2, you can check opened access by:

    func isOpenAccessGranted() -> Bool {
        return UIPasteboard(name: "checkOpenedAccess", create: true) != nil
    }
    
    0 讨论(0)
  • 2020-12-02 08:10

    This is the simplest answer by far and doesn't require you to setup app groups. It is tested in production on the app store.

    + (BOOL)isOpenAccessGranted
    {
        return [UIPasteboard generalPasteboard];
    }
    
    0 讨论(0)
提交回复
热议问题