How to associate iPhone application with _every_ file type?

前端 未结 3 1461
天命终不由人
天命终不由人 2021-02-13 02:41

There is iPhone app \"Another Mail Client\" that should be able to open any file to send it as attachment. So, I want to associate this application with any file with any extens

3条回答
  •  旧巷少年郎
    2021-02-13 03:16

    Friend, I read your question properly before posting the answer. I gave another thought that you will have a set of already known "any types" of files to register in a bulk. However, you want to dynamically accommodate your app to register any file type given to your app in future and make it attachable. For this as far as my knowledge is concerned, you cannot make you app to universally support any unknown file type. Let me explain what happens,

    1. Suppose you make an application APP1 then it does not know about a file extension .XYZ and install it on iPhone.

    2. But, later I develop another application APP2, which contains the above code and I register the .XYZ type from APP2 in whatever iPhone it installs.

    3. So, lets say I install APP2 in your iPhone, having APP1. And when my app runs, then the .XYZ extension ( known to APP2 ahead of time) gets registered into the iPhone.

    This is the reason now your app APP1 can use this .XYZ file surprisingly.

    Concluding, you have to know a specific type of extensions ahead of time before making the app.

    However, heres a possible solution for it.

    Solution :

    1. Decide the maximum number of characters you want to support in an extenstion. Lets say 4.

    2. Now you can make a small Brute-Force routine to run in your app to make all the possible character combinations and register them all. This should make any file with extension upto 4 characters attachable to mail.

    I hope that should do the trick.

    Best of luck!

提交回复
热议问题