Flickr integration in iOS app - iphone

I have an issue while integrating flickr in iOS app.
When I click on authorize button then it shows alert message as safari cannot open webpage because the address is invalid.
If anyone knows then please help me.
Thanks in advance.

My best guess is you are missing URL SCHEME in your project plist. Below is the screenshot showing current sample from flickr sdk which I downloaded from github and there is a setup done for URL Scheme handling.
Its called oAuth handling when SAFARI is finished verifying the credentials and want to return to the application it returns URL which can be handled by the application mentioned in plist and which we will handle from application delegate using following function
So you need to provide your URL identifier and URL Scheme for your project which you can get if you register in flickr api.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
}

Related

Google plus API doesn't return to app on login

Obviously I must be missing something.
When I press my Google + button, it opens up safari and prompts for the login. Everything is fine until I complete the login procress. Safari tells me "Cannot open the Page -- Safari cannot open the page because the address is invalid". It never takes me back to my app, but keeps Safari open and goes to google.com.
I was thinking this would take care of that, but break points aren't ever going off in this method. Maybe I'm misunderstanding how it works.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];
}
Thanks for any help you can provide
Take look to the Bundle Identifier that is in your project and that you have registered with https://code.google.com/apis/console . Both of them should be same. After that make sure also you have set that same URL Schemes in URL Types in your application plist file.
I had this same problem today. I finally compared the sample app (included w/ SDK) line by line before I figured my problem out.
I didn't realize the ClientID found in the Developers Console was in standard domain name order while the URL Scheme for 1 of the 2 URL Types in the project settings (Info.plist) needs to be in reverse domain name notation
ClientID in Developers Console is [guid].apps.googleusercontent.com
URL Scheme in Info.plist is com.googleusercontent.apps.[guid]

Custom URL Scheme for iOS App when not backgrounding

I have set up a custom deep-linking iOS URL scheme for my app, and I listen for it in
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
I parse the URL and send a notification using NSNotificationCenter, with the URL as the object, to the appropriate class to handle the URL.
This all works great when the app is "backgrounded" but when the app is fully closed out of multitasking, it seems like the notification never gets sent (or received). Am I missing something about the process of notifications when the app isn't in backgrounding? Is there another way to pass along the information from the URL? Or is there at least a way to tell if the app is coming out of backgrounding or if it is a fresh launch?
Thanks!
You should check the launchOptions dictionary that is passed into applicationDidFinishLuanching:withOptions:.
For full details on what is included in the options dictionary: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html

Launching App from another App using NSURL

There are apps in the iOS app store that let you send encrypted messages via sms and it seems like they are using NSURL to create a clickable link that opens their app automatically (from the iMessage app) with the "hidden message" already showing in the app.
My question is, how does one store information within an NSURL? I figured out who to launch my app from another app using NSURL but how can you store extra information for the launched app to use such as text, an image, or a link to an online video?
I apologize if this is a basic question, I haven't had to work with URLs much. Many thanks.
We can achieve communication between apps through the URL Schemes concept.
if you can go through this link below, you will get some idea on how to share data between the applications
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/
When you register an URL scheme in your application's info.plist like myapp you can use the following url's to invoke your application.
myapp://
myapp://some/path/here
myapp://?foo=1&bar=2
myapp://some/path/here?foo=1&bar=2
And you can check the received url's in the
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
method of app delegate and do the action according to each url.
Reference : Launching application via custom url scheme
The data is not stored in NSURL. However, you can pass parameters along with the URL and accordingly retrieve them in the new opened app.
Now you can use these params in the way you want.

FacebookSDK for iOS, Facebook login doesn't Get back to my iOS app

I am trying to use the Facebook sdk with my iOS application,
I am using xcode 4.5.2 with SDK v6.0
My device is iPod touch v6.0.1
I have a provisioning profile set
I have subscribed as a facebook developer and registered a facebook app inclusing
'Bundle ID'
'Enabling 'Facebook Login'.
...
I have set the facebook AppId at my plist file under 'URL Types'->'Item 0'->'URL
Scemes'->'Item 0'.
When using the physical device, my application is switching to the facebook login page, however, after logging in, it doesn't go back to my application!!!
Surprisingly, when using the simulator everything works great, my app is going back and forth from the facebook login page.
What might I be doing wrong? why on the physical device I cannot get back to my app after logging in while when using the Simulator I can? might this be somehow related with the provisioning profile ?
Any help will be appreciated.
At earl year, i got a same issue and i am testing with HACKBOOK example and as same as your issue. i can run well in simulator but when i tested in device i got same problum and then i just put that bellow code and working great.
simply you just need to add this method in your app delegate:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [self.facebook handleOpenURL:url];
}
This method usefull for login with fbApp or safari. for redirect back to our app from facebook login page
Go to facebook.m class in your SDK find this method:
- (void)authorize:(NSArray *)permissions
delegate:(id<FBSessionDelegate>)delegate
Then replace your last line which is:[self authorizeWithFBAppAuth:YES safariAuth:YES];
With this line:[self authorizeWithFBAppAuth:YES safariAuth:NO;& check.
The problem was that the base class was implementing 'applicationDidBecomeActive' and 'applicationWillTerminate' ( where '[FBSession.activeSession handleDidBecomeActive]' and '[self.session close]' are correspondingly called ) while the inheriting class implemented the same methods w/o calling the base [super] class implementation.

Launching application from a SMS message

I am new to iphone application development.
I have a sample application that needs to be launched from a SMS message. I have no idea on how to do this. Please help me.
Note that if SMS operates in the same manner as Mail on the iPhone, you'll need to enclose your custom URL in brackets to make it launch the application responding to that scheme. For example,
<yourapp://yoururl>
will work, but
yourapp://yoururl
will not.
Allow your application to respond to some url (eg: myapp://launch ) and include the url in the SMS, when the user launches that URL your application will launch.
I'm sure that is not the most straight forward way (since the SMS needs to include your custom URL) but I don't know if it is possible with any arbitrary SMS to launch an arbitrary applciation
do a google on iphone URL scheme and you will find lots of detail on how to implement this
here is an example
the below appdelegate method tells the full url that used to open your app
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
//you could parse the url and take action according to that
}
The below app delegate method tells which app caused to open your app
- (BOOL)application:(UIApplication *)application openURL: (NSURL *)url sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
//you could capture the refered app custom url and open back from your app
return YES;
}
with following code snippet you could open the app that opened your app
NSURL *urlObj = [NSURL URLWithString:url];
[[UIApplication sharedApplication] openURL:urlObj];
Pass the custom app url.
It works fine. thanks hhafez!
I composed a SMS with url format "myapp://". It didn't work. Then I tried "", then it worked. thanks Brad!