This is a pretty simple question- how can I check if a NSURL is linking to a local file?
I know, RTFM, but I checked the documentation and I don't seem to see any methods related to this.
The only methods I did find were -isFileReferenceURL and -isFileURL, but I think these only check if the URL directly links to a file.
Note: I'm making an iPhone app, so by "local file" I mean a .html file stored in the project's resources.
Thanks for any help in advance.
The -isFileURL will check if your URL uses the file: scheme. It doesn't check whether it's referencing an actual file.
There is -isFileReferenceURL as of iOS 5 that checks if the url is an file reference. Before 5.0, it did nothing according to the documentation..
Available in iOS 5.0 and later. (Symbol is present in iOS 4, but performs no operation.)
I hope this helps the new-comers...
Related
I'm playing around with this code example.
What I am trying to do is create a 100% Swift iOS version of this metronome app that allows playing of the MoreCowbell.caf file similar to how they have already done in the macOS example.
It makes logical sense that IF there were some way to reference this MoreCowbell.caf "asset"/"resource" (?) using the URL format, then the above code could work.
Is there a way to do that? If not, then how can we refer to MoreCowbell.caf from code in order get those ones and zeros into the sound buffer?
I have done much googling and looking at apple documentation but and going in circles so thank you for any help!
You can get a URL to files in your Bundle (ie. in your App) by using a method on Bundle (or NSBundle when using Objective-C). It works like this:
let fileURL = Bundle.main.url(forResource: "MoreCowbell", withExtension: "caf")
You can find more information on this in the official documentation.
Also make sure that the file MoreCowbell.caf is included in your Bundle. You do that by setting it's Target Membership
I am trying to implement deep linking. I have followed the documentation and created the 'apple-app-site-association' file and very sure there is no mistake in the file format. The file has been placed in the root directory as well as the backend side.
My domain does not use https, only http. Does the file need to be signed irrespective of this?
Following is the apple doc which I used for reference document
I have read that there is no need to sign the apple-app-site-association file.
I am perplexed as to what I am missing.
When using HTTP, I think the answer may be yes. The documentation says that you don't need to sign the apple-app-site-association file if you are using HTTPS:
This leads me to believe that you may need to sign it if you are using HTTP. Apple's Validation Tool may be helpful to test this.
If you're still having problems after getting past the validator, see iOS9: Universal Links does not work, which has many good answers about the many things that can go wrong with deep linking.
I want to allow users of my app to send PDF which is in the device.
The problem is, I don't see how to do that...
First, where are the files downloaded ? In which directory ? And how to list these files ?
I see there is NSfileManager but I don't understand how to use that.
I want something like DocumentPicker. (but available for iOS 7)
There is no common central directory in iOS that stores PDF files in way you describe. Nothing.
Each app has its own Documents folder, and apps have absolutely no way to see each others docs folder. So you, as a new pdf manager custom written app will not be able to look into other apps docs folder.
NSFileManager is a standard Cocoa class the handles files in a generic manner.
I have two apps. The first one checks for passwords and credentials and if all is well, then launches the second app. Can I bundle/package the two apps into one? The intent is to present the whole thing as a single app to the Appstore.
Is this approach supported for iOS and accepted by Apple?
How about framework? Although I think a customised framework is not supported for iOS which is of no use to my case.
Any hints or code samples as how to achieve this (if at all possible) is very much appreciated.
Thank you for your help.
You can't bundle two apps, but you can write your own framework that checks credentials and add that to your app. From the information you give, I can't see the reason why you need to put credential checking into an extra framework. Can't you do the check inside your app?
I suggest you to create a library for Login (where you can check the credentials of user once authentication is success use protocols to send the information of user or the status (success or failure) to the main app where your total application is presented). Creating a library (.a and .h) file is easy here you can't use Xib files and images for this you need to create a new bundle where all your Xib's and images are added for library purpose. In other case you can use images as a base64 string. So your total app is now splitter into 2 parts 1. Library for Login 2.All other features. If you need more information on this please let me know.
Hope this will give you an idea and helpful
I am making an app on iphone and I have got stucked at one point. I want to read a text file which has some list of URLs and then I need to read that file and open those URLs one by one in UIWebVIew. Can anyone suggest me how can I do that?? with some sample example.
Thanks in advance.
Check out NSDataDetector, you can find links by dataDetectorWithTypes:error: using NSTextCheckingTypeLink. More documentation: https://developer.apple.com/library/ios/DOCUMENTATION/AppKit/Reference/NSTextCheckingResult_Class/Reference/Reference.html