-
-
Save mustafa/d3c8c6938db45af0667f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableDictionary* appBridgeData = [NSMutableDictionary dictionary]; | |
ENSearchRequest* request = [[ENSearchRequest alloc] init]; | |
[request setQueryString:@"notebook:\"Food\""]; | |
NSData *requestData = [NSKeyedArchiver archivedDataWithRootObject:request]; | |
[appBridgeData setObject:requestData forKey:kEN_ApplicationBridge_RequestDataKey]; | |
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; | |
if (infoDictionary != nil) { | |
NSString *appIdentifier = [infoDictionary objectForKey:(NSString *)kCFBundleIdentifierKey]; | |
if (appIdentifier != nil) { | |
[appBridgeData setObject:appIdentifier forKey:kEN_ApplicationBridge_CallerAppIdentifierKey]; | |
} | |
NSString *appName = [infoDictionary objectForKey:(NSString *)kCFBundleNameKey]; | |
if (appName != nil) { | |
[appBridgeData setObject:appName forKey:kEN_ApplicationBridge_CallerAppNameKey]; | |
} | |
} | |
[appBridgeData setObject:[NSNumber numberWithUnsignedInt:kEN_ApplicationBridge_DataVersion] forKey:kEN_ApplicationBridge_DataVersionKey]; | |
[appBridgeData setObject:[request requestIdentifier] forKey:kEN_ApplicationBridge_RequestIdentifierKey]; | |
[appBridgeData setObject:[[EvernoteSession sharedSession] consumerKey] forKey:kEN_ApplicationBridge_ConsumerKey]; | |
NSString* pasteboardName = [NSString stringWithFormat:@"com.evernote.bridge.%@",[[EvernoteSession sharedSession] consumerKey]]; | |
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:pasteboardName create:YES]; | |
[pasteboard setPersistent:YES]; | |
[pasteboard setData:[NSKeyedArchiver archivedDataWithRootObject:appBridgeData] forPasteboardType:@"$EvernoteApplicationBridgeData$"]; | |
NSString* openURL = [NSString stringWithFormat:@"en://app-bridge/consumerKey/%@/pasteBoardName/%@",[[EvernoteSession sharedSession] consumerKey],pasteboardName]; | |
BOOL success = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:openURL]]; | |
if(success) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment