eReader SDK in IPad - ios

I need to developed an application for iPad, which shall download eBook from a server and launch eReader application,
i Believe eReader is App provided by amazon for iOS, i.e. whatever user brought form Amazon can read through eReader, i have following question,
1 -- Can i developed an application which invokes eReader app if its there,
2 -- are there any sdk available to access eReader properties, i just wanted to know, how long this application has been used.

1) You can open other apps using URL schemes. To open the Kindle app:
NSString *stringURL = #" kindle:/home";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
2) No, you can't acess any information about other apps using the standard APIs (i.e., without jailbreaking the device).

Related

UIApplication openURL vs NSURLConnection initWithRequest for launching iTunes

I want to launch iTunes via my app. Currently there's a code that's doing that using [NSURLConnection alloc] initWithRequest. I'm thinking about changing it to [UIApplication sharedApplication] openURL.
What is the difference and what is the correct way?
Q: How do I launch the App Store from my iOS app? Also, how do I link to my application on the store?
A: The -[UIApplication openURL:] method handles links to applications and media by launching the appropriate store application for the passed NSURL object. Follow the steps below to obtain a link to an application, music, movie, or TV show sold on iTunes, and link to it from your iOS application:
Launch iTunes on your computer.
Search for the item you want to link to.
Right-click or control-click on the item's name in iTunes, then choose "Copy iTunes Store URL" from the pop-up menu.
In your application, create an NSURL object with the copied iTunes URL, then pass this object to UIApplication' s openURL: method to open your item in the App Store.
Listing 1 Launching the App Store from an iOS application
NSString *iTunesLink = #"https://itunes.apple.com/us/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
see https://developer.apple.com/library/ios/qa/qa1629/_index.html
[UIApplication sharedApplication] openURL used when you need go to another app. In your case its AppStore
iOS Developer Library
Discussion:
The URL can locate a resource in the same or other app. If the resource is another app, invoking this method may cause the calling app to quit so the other one can be launched.
1.[NSURLConnection alloc] initWithRequest: is a way of network request.
you use it if you want to get some data from network
2.[UIApplication sharedApplication] openURL: can open an app according to the param.
I guess you may want to use [UIApplication sharedApplication] openURL:

Opening TestFlight app from another app and deep link to specific app

How do i find the scheme of another app and deep link to it from my own iOS app?
More specifically, I want to deep link to the Testflight app upon certain conditions (set by my code). I'm assuming the person has Testflight installed, (which might be a bad assumption but we can live with that assumption).
I know that on Android, you can query for apps and send intents to deep link to someone else's app. What would be the equivalent on iOS?
There are two things you need to do. First, check to see if TestFlight is installed. Then create a new link to your app.
NSURL *customAppURL = [NSURL URLWithString:#"itms-beta://"];
if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
// TestFlight is installed
// Special link that includes the app's Apple ID
customAppURL = [NSURL URLWithString:#"https://beta.itunes.apple.com/v1/app/978489855"];
[[UIApplication sharedApplication] openURL:customAppURL];
}
This special https://beta.itunes.apple.com URL will be opened directly in TestFlight.
Finally, if you are using iOS 9 (or later), you need to make an addition to your Info.plist to get the canOpenURL: method to work.
If your app is linked on or after iOS 9.0, you must declare the URL
schemes you want to pass to this method. Do this by using the
LSApplicationQueriesSchemes array in your Xcode project’s Info.plist
file. For each URL scheme you want your app to use with this method,
add it as a string in this array.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>itms-beta</string>
</array>
From looking at the plist the URL scheme for TestFlight is "itms-beta://" I can't manage to get it deep linking yet, I've tried passing it the Apple ID, with and without a ? along with prefixing it with appleid= I will try bundle ID next.
To open the TestFlight app on the users device you can use:
NSURL *customAppURL = [NSURL URLWithString:#"itms-beta://"];
if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
[[UIApplication sharedApplication] openURL:customAppURL];
}
Swift 3/4 answer:
if let customAppURL = URL(string: "itms-beta://"){
if(UIApplication.shared.canOpenURL(customAppURL)){
UIApplication.shared.open(customAppURL, options: [:], completionHandler: nil)
}
}
Most of the built-in applications Apple provides respond to custom URL schemes; for example, the Maps, Mail, YouTube, iTunes, and App Store applications will all open in response to custom URLs. However, there are also many established third-party applications with published URL schemes that you can use in your own application. You can search the applications schemes on
http://handleopenurl.com/
http://wiki.akosma.com/IPhone_URL_Schemes – both have a great list of URL schemes
Once you got the custom URL scheme then you can deep link to that app using the same schema,
NSURL *customAppURL = [NSURL URLWithString:#"urlscheme://"];
//Eg: NSURL *whatsappURL = [NSURL URLWithString:#"whatsapp://send?text=Hello%20World!"];
if ([[UIApplication sharedApplication] canOpenURL:whatsAppURL]) {
[[UIApplication sharedApplication] openURL:whatsAppURL]]];
}
Another way to invoke either one app or another:
- (IBAction)go:(id)sender {
NSString *cnnAppURL = #"cnn://";
NSString *mapsAppURL = #"maps://";
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:cnnAppURL]];
NSString *url = canOpenURL ? cnnAppURL : mapsAppURL;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
Please read "UseYourLoaf's recent blog post on using URLschemes with canOpenURL. This relates to new security concerns and solutions. Quote:
"This is useful but developers including Twitter and Facebook were using this mechanism to discover the list of Apps installed on a device so they can deliver “tailored content”. Apple decided this is a privacy violation and so in iOS 9 restricted the querying of URL schemes. If you build and link against the iOS 9 SDK you need to whitelist the schemes your app will query. What is important to understand is that this policy can also impact older Apps that have not yet been rebuilt with the iOS 9 SDK."
Please read this link on issues related to the canOpenURL function
Read #picciano's last point - this won't work without modifying your app's plist.

Detect app installation with StoreKit

iOS6 introduced StoreKit framework which is designated for interacting with the AppStore from within the app.
I easily managed to direct the user to a specific app, the question is how can I detect whether the user actually installed the app I redirected him to?
This is usually done by calling -canOpenURL: on UIAplication object like this:
NSURL *appURL = [NSURL URLWithString:#"fb:"];
BOOL appInstalled = [[UIApplication sharedApplication] canOpenURL:appURL];
But you need to know what URL scheme does the second app open. It is declared in Info.plist file by the app developer.
There is an open source framework called "iHasApp" avaiable that can detect installed apps.
Git Repository: iHasApp

Open setting from my app

I am using iCloud for core data. if user is not logged in on iCloud i want to take him to setting page, is it possible in ios.
Thanks
If you are writing app for iOS < 5.1 then you can use custom URL schemes - find list here.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: myUrlString ]]; //find myUrlString in link above
But this feature was removed in iOS 5.1 and most likely won't available in the feature

Direct link for application updated version in AppStore

Within my application there is alink to to appstore for downloading the new version of my application.
When user press this link, the iPhone open some screes before getting the AppStore screen.
Those screen, seem to be the browser's screens, but i'm not sure.
How can i create a direct link to my application in AppStore?
Thanks,
Eyal.
itms-apps://itunes.com/apps/APPNAME
Example:
NSURL *url = [NSURL URLWithString:#"itms-apps://itunes.com/apps/trenes"];
[[UIApplication sharedApplication] openURL:url];

Resources