Add more one button on Attach menu of Whatsapp - whatsapp

I've an idea to develop a modification to WhatsApp, for example now when I click attachment symbol it shows only 6 I want to add one more option to it. If it's possible let me know. I want to add more one button on Attach menu.

It is not clear what exactly you are asking.
You have an option to launch other applications from your app.
If you want to change the way a certain app looks, or behaves you have to write something similar to it for people to use, but you cannot change the original app (no one will let you)

Here you go! it's possible, as #Jef said in comments.
using documentation interaction controller.
https://www.whatsapp.com/faq/iphone/23559013
you need to work on how to hook into attachment menu.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocumentInteractionController_class/

There is an assumption in your question that these other apps are put there by the whatsApp developers, or by a third party who was somehow able to modify their code. I suspect that what is happening is that they (whatsApp) simply export a document/file of a certain type (UTI) If your application supports that same UTI it should appear here. So there is six buttons for you, on your phone, but another user might see a different number, it depends entirely what they have installed on their device.
CONCEPTUAL.. if you double click on a file on your computer then the file browser (OS) opens that file with some application or other. Perhaps it is a .doc file and the OS pushes that file to word or pages. Or it may be a .psd file and it gets pushed to photoshop. How does this happen? The OS has a registry (database) of applications for each file type, applications sign up on this when they install/update. If you right click on a file you see an 'open in..' option that lists all your applications which can handle that file type, this is the menu that you are wanting to get onto (for whatsApp's file type) imho.
So you need to
1 ascertain what file type (UTI) WhatsApp is exporting
2 declare support for that file type in your application (this is the bit which will be platform specific solution) (iOS docs https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/RegisteringtheFileTypesYourAppSupports.html#//apple_ref/doc/uid/TP40010411-SW1 )
**edit/addition
3. add the code to actually handle the file when your app receives it. On iOs this is in the appDelegate in
-(void) application: openURL: sourceApplication:annotation:
If the Whatsapp people have published an API then thats where you want to look. Good luck

Related

How do I add my own option to Finder's right click menu?

I have an app that basically takes a file path(s) and copies the data name and extension from it to be used in my app. I was wondering how to add on to the Finder right click menu (like Dropbox does) and do run some Objective-C code when clicked. (I need to get the path(s) of the selected file). Is there any way to do this? All the answers I've seen are very vague and unhelpful. I do not want to use mach_inject because my app might go onto the appstore, and I can probably get FinderSync API to work.
Take a look at the FinderSync API in Yosemite; I'm fairly sure you don't need to sync anything, but you can use the API to install a toolbar and sidebar item as well.

Register Double-Click on Desktop (but not on Icons !)

Here's a though question:
I need to find out when the user double-clicked the OS X desktop, but not icons on it.
Now, I have thought of the following solutions, though I am not sure if they are doable:
Using desktop icons position (not sure how to get them), and the size of the desktop icons, we could theoretically check once the user double-clicks on the desktop, if it is inside one of the icon areas. Contra: Might not be flawless as some icons might be transparent or not taking up the entire icon size.
Maybe there is a variable that tells us if a icon from the desktop has been clicked? Then we could just check if that variable has been activated when the user double-clicked the last time the desk.
I am certainly still open to other (better) solutions, but they need to be sandboxable for the Mac App Store.
This is probably not going to be appropriate for the Mac App Store, for a number of reasons.
First, how are you going to intercept clicks outside your window? There are a few different mechanisms for this (e.g., event taps), but none of them are allowed in sandboxed apps. And that's intentional, and for a good reason—you're not supposed to be interfering with other apps or with the OS.
On top of that, it's hard to imagine that whatever you're trying to do wouldn't count as non-standard UI/HIG stuff, which is another reason for rejection.
But, assuming none of that were a problem, and you could intercept clicks on the desktop, there's no documented way to get all the icons on the desktop, so you have to read the .DS_store file directly, which means relying on private implementation information, which is another thing you're not allowed to do.
Finally, you have to get access to that .DS_store file. Unless you're expecting the user to drag the (invisible) file or its parent directory to your app or select it in an NSOpenPanel or something, the only way to get such access from inside the sandbox is via a temporary exception entitlement. Which you can't use unless you can justify to the reviewer why you need it as a workaround for a bug or limitation in the OS. So, what's your justification going to be?

'Open In' functionality after downloading document?

I am developing an iOS app that allows users to download documents off a server. I have gotten this to work fine and they can even view the document. What I want, though, is for the document to have an 'Open In' action so, when a button is pressed, the user is able to select another application that allows you to look at PDF documents -- for example, the Kindle App. Is this possible?
Darn, I was wishing you were going to say "MacOS" because that would have made the answer a lot more fun (and do-able).
As far as I know, iOS still does not have an official SDK-legal way to have one app (your app) arbitrarily launch other app and specify an arbitrary document to open with it. This is part of the magic (?) of having to live within your own app sandbox.
On the Macintosh, this would be easy with Apple Events (among other things).

Mac Sandboxed App Loses File Permissions to Other Apps

I'm developing an app that is currently sandboxed. It acts as a basic text editor. Recently, I wanted to test what happens when I open a file in my app and another app at the same time, make an update in one app, then then see the updated in the other. I'm using Coda or BBEdit as my alternative editors. If I turn off sandboxing -- then this issue does not exist. However, since apps are required to be sandboxed as of March 1, I would rather implement a solution rather than wait and see.
When I open both files and make an edit in my app and then switch to the other app, the changes are reflected so that those editors have the version just saved from my app. However, if I perform the converse of saving from their app and then moving to mine -- no joy. Without performing any action, the console reports two specific errors: deny file-issue-extension and deny file-write-data. The app appears to be losing privileges to edit the document since it was changed by an external editor after the document was opened in my app. If I try to save the file in my app, it asks to duplicate the document because it has lost access to the original document. This doesn't happen the other way around because those apps have not been sandboxed and therefor have permissions that my app does not. It also doesn't appear that you can prevent the other app from making the changes if you don't want this behavior.
The documentation on developer.apple.com mentions nothing of this type of situation. I am not sure if this is intended behavior. If it is, then I can just tell my user that the document permissions have been lost and they should either save a new version or re-open the file. If it is NOT intended behavior, then what method in the NSDocument API would grant permission to the file once it has been lost? I'm assuming the answer is the former, that this is intended, but can anyone confirm and is there documentation?
Without performing any action, the console reports two specific errors: deny file-issue-extension and deny file-write-data. The app appears to be losing privileges to edit the document since it was changed by an external editor after the document was opened in my app. If I try to save the file in my app, it asks to duplicate the document because it has lost access to the original document
The correct behavior in a situation like this is to not overwrite the file, but to prompt the user if they want to reload the document, if so reload it and then write it.
The OS is doing the right thing by not allowing a blind write over a file that has changed.
See NSFilePresenter - (void)presentedItemDidChange to see if it changed. Reread the file and then see if you can save it. You dont say you have been denied a read on the file.
Also, since you havent posted any code it might be helpful to show what code you are using to access the file and to save it. NSDocument has built in handling for some types of file changes in the sandbox.
Lets call your App ScottEdit and your competitor as StackEdit
There could be several things going on. NSDocument has a lockDocument method. StackEdit may have locked the document and did NOT unlock it after save. If you quit the app, the file should be unlocked and available for your app. If this is the case, you will need to create a notification for when the file attributes change using kqueue or another.
If the other app is "blocking" access to your app. You can send an email to that developer and ask him to update his app so it unlocks the document after save. This last step is in addition to setting up notifications because another developer may come along and do the same thing (breaking your app).

Launch application using openwith on mouse click

Can any one tell me about how to lanch a self-made application using the "openwith" feature of a mouse click event?
Your question is not very clear, but I understand it as "How do I tell the Finder that my application knows handle certain file types?". Once the Finder knows the link, it will suggest your application in the Open With submenu that appears when you ctrl/right-click on a file.
Have a look at the Apple documentation. Basically, you have to declare all the supported file types in Info.plist (or what you called it). The system is based on Universal Type Identifiers.