   public func getData(key: String) -> NSData? {
     let prefixedKey = keyWithPrefix(key)
     
-    let query = [
+    var query: [String: NSObject] = [
       KeychainSwiftConstants.klass       : kSecClassGenericPassword,
       KeychainSwiftConstants.attrAccount : prefixedKey,
       KeychainSwiftConstants.returnData  : kCFBooleanTrue,
       KeychainSwiftConstants.matchLimit  : kSecMatchLimitOne ]
     
+    query = addAccessGroupWhenPresent(query)
+    lastQueryParameters = query
+    
     var result: AnyObject?
     
     let status = withUnsafeMutablePointer(&result) {

      
    let prefixedKey = keyWithPrefix(key)
      
    let query = [
      KeychainSwiftConstants.klass       : KeychainSwiftConstants.classGenericPassword,
      KeychainSwiftConstants.attrAccount : prefixedKey,
      KeychainSwiftConstants.valueData   : value,
      KeychainSwiftConstants.accessible  : accessible
    ]
      
    lastQueryParameters = query
          
    SecItemDelete(query as CFDictionaryRef)

  public func delete(key: String) -> Bool {
    let prefixedKey = keyWithPrefix(key)

    var query: [String: NSObject] = [
      KeychainSwiftConstants.klass       : kSecClassGenericPassword,
      KeychainSwiftConstants.attrAccount : prefixedKey ]
    
    query = addAccessGroupWhenPresent(query)
    lastQueryParameters = query
    
    let status: OSStatus = SecItemDelete(query as CFDictionaryRef)
    
    return status == noErr
