Download Connection From LinkedIn and import into iPhone Contacts - ios

Can anyone help me , I want to Download the connection of LinkedIn and Add into iPhone Address Book.
I googled it but not getting any help.
I am using following Api :
NSURL *url = [NSURL URLWithString:#"http://api.linkedin.com/v1/people/~/connections"];
and I am getting the response like:
profile {
errorCode = 0;
message = "Access to connections denied";
requestId = GVG2FXA2N0;
status = 403;
timestamp = 1366641414499;
}

There is AddressBook framework for that:
http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/
a wrapper library:
http://maniacdev.com/2012/02/open-source-ios-address-book-wrapper-library-providing-automatic-hashing-and-permission-alerts/
Simple tutorial:
http://programming4.us/mobile/9260.aspx

You must be missing r_network scope.Even I was getting same error. But when I added r_network scope the problem resolved

Related

iOS Facebook SDK - Error code 8

The Facebook SDK for iOS worked great until now. Since 2 hours ago, I'm constantly receiving the following error message when I'm trying to log in with Facebook:
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x7fb060edae20>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2, NSLocalizedRecoverySuggestion=Momentan serverul este ocupat. Te rugăm să încerci din nou., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unexpected error has occurred. Please retry your request later., com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1, NSLocalizedRecoveryOptions=<CFArray 0x7fb0638b71b0 [0x10c2fea40]>{type = immutable, count = 1, values = (
0 : OK
)}, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 2;
"fbtrace_id" = Et3O2yEtpV7;
"is_transient" = 1;
message = "An unexpected error has occurred. Please retry your request later.";
type = OAuthException;
};
};
code = 500;
}}
I have verified:
The bundle ID is correct
The parameters are correct - id,email,name,gender,birthday,picture.width(1080).height(1080),bio,location,friends
The SDK is correctly installed (info.plist with all the requirements - fb{app-id} etc)
All the methods inside the AppDelegate are added and are correctly updated for iOS 9
What should I do? I have tested the SDK on another app and there it's working.

Amazon SES: Unable to send mail for verified email address, if region is changed

I'm integrating Amazon SES SDK in my iOS app. I have recently observed that, I'm unable to send mails from a verified email address. if I switch to US_WEST_2 region. The problem seem to be with iOS SDK, as I'm able to send mail from Amazon Console using same mail address.
Error Message:
exception={SESMessageRejectedException { RequestId:70ed2e9e-dc16-11e3-89ca-956987a01a60, ErrorCode:MessageRejected, Message:Email address is not verified. }}, errorCode=MessageRejected}
Code:
SESManager class:
SESSendEmailRequest *ser = [[SESSendEmailRequest alloc] init] ;
ser.source = strSenderMailAddress;
ser.destination = destination;
ser.message = message;
SESSendEmailResponse *response = [[AmazonClientManager ses] sendEmail:ser];
AmazonClientManager:
+(AmazonSESClient *)ses
{
[AmazonClientManager validateCredentials];
return ses;
}
+(void)validateCredentials
{
if ([AmazonClientManager hasCredentials]) {
[AmazonClientManager clearCredentials];
ses = [[AmazonSESClient alloc] initWithAccessKey:[Lockbox stringForKey:kLockboxAmazonAccessKey] withSecretKey:[Lockbox stringForKey:kLockboxAmazonSecretKey]];
ses.endpoint = [AmazonEndpoints sesEndpoint:#"https://email.us-west-2.amazonaws.com"];
}
}
It sounds like what you are seeing is by design.
The regions are independent systems, like much of AWS.
“You must verify each sender’s email address separately for each region you want to use.”
— http://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html
sesEndpoint: takes an AmazonRegion, which is defined as follows:
typedef enum
{
US_EAST_1 = 0,
US_WEST_1 = 1,
EU_WEST_1 = 2,
AP_SOUTHEAST_1 = 3,
AP_NORTHEAST_1 = 4,
US_WEST_2 = 5,
SA_EAST_1 = 6,
AP_SOUTHEAST_2 = 7
} AmazonRegion;
You need to change this line:
ses.endpoint = [AmazonEndpoints sesEndpoint:#"https://email.us-west-2.amazonaws.com"];
to this:
ses.endpoint = [AmazonEndpoints sesEndpoint:US_WEST_2];
When you pass an invalid region, it will default to the US East 1 region. That's why you are getting the exception.
Hope this helps,
I would suggest instead of verifying emails you look on the following issue where you can make it more Production based.
How can i send mail without verifying the recipients in amazon ses
This approach is more correct & more appropriate even though you do it for any region.

Failed to validate OAuth signature and token twitter integration ios GTM-OAuth

I am using following code to handle twitter integration in my Application.
- (IBAction)signInWithTwitter:(id)sender {
NSURL *requestURL = [NSURL URLWithString:#"https://api.twitter.com/oauth/request_token"];
NSURL *accessURL = [NSURL URLWithString:#"https://api.twitter.com/oauth/access_token"];
NSURL *authorizeURL = [NSURL URLWithString:#"https://api.twitter.com/oauth/authorize"];
NSString *scope = #"http://api.twitter.com/";
GTMOAuthAuthentication *auth = [self authForTwitter];
[auth setCallback:#"http://www.noop.com/OAuthCallback"];
GTMOAuthViewControllerTouch *viewController;
viewController = [[GTMOAuthViewControllerTouch alloc] initWithScope:scope
language:nil
requestTokenURL:requestURL
authorizeTokenURL:authorizeURL
accessTokenURL:accessURL
authentication:auth
appServiceName:#"CK12: Twitter"
delegate:self
finishedSelector:#selector(viewController:finishedWithAuth:error:)];
}
- (GTMOAuthAuthentication *)authForTwitter {
GTMOAuthAuthentication *auth = [[GTMOAuthAuthentication alloc] initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
consumerKey:TWITTER_CONSUMER_KEY
privateKey:TWITTER_CONSUMER_SECRET];
[auth setServiceProvider:#"Twitter"];
return auth;
}
My problem is, if I am changing device time i.e making it 1 hour late, then I am getting following error:
Error Domain=com.google.HTTPStatus Code=401 and error message is : failed to validate oauth signature and token .
So can anybody please suggest how to solve this. if system time is wrong then also I want to make it work .
Finally I got solution for this . . . .
One of the reason we get this error "Failed to validate OAuth signature and token"
when system time is wrong . Because OAuth request carry system timestamp parameters with it , so when device time is not within the 5 minutes of twitter server time .we get "Failed to validate OAuth signature and token" .
There are two ways to make it work , if the device time is even wrong .
1.make HTTP HEAD request to an endpoint on api.twitter.com -- you'll get a Date HTTP header in the response that indicates the current time understood by Twitter. You would then convert this to epoch time and adjust your oauth_timestamp values by a determined offset.
2.There's a small iOS library named ios-ntp link: http://code.google.com/p/ios-ntp . use this to get the current Accurate time .
After that i just set the timestamp of OAuth object in the following method
- (GTMOAuthAuthentication *)authForTwitter
{
GTMOAuthAuthentication *auth = [[GTMOAuthAuthentication alloc]
initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
consumerKey:TWITTER_CONSUMER_KEY
privateKey:TWITTER_CONSUMER_SECRET];
[auth setServiceProvider:#"Twitter"];
NSDate * currentdate = //GET ACCURATE DATE HERE ;
[auth setTimestamp:[NSString stringWithFormat:#"%f",[currentdate timeIntervalSince1970]]];
return auth;
}
that's it . . .Happy Coding :)

Can't twitter status using oAuth and .net Hammock library on Windows Phone 7

I've been able setup the oAuth calls to get the users access Token following a couple blog posts:
http://sudheerkovalam.wordpress.com/2010/08/28/a-windows-phone-7-twitter-application-part-1/
and
:/byatool.com/c/connect-your-web-app-to-twitter-using-hammock-csharp/comment-page-1/#comment-9955
But I'm having problems sending a status update. I can't find any examples so I may not be setting the proper values. Here's the code which keeps returning: "Could not authenticate with OAuth."
private void Tweet()
{
var credentials = new OAuthCredentials
{
Type = OAuthType.ProtectedResource,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
ConsumerKey = TwitterSettings.ConsumerKey,
ConsumerSecret = TwitterSettings.ConsumerKeySecret,
Token = _settings.AccessToken,
TokenSecret = _settings.AccessTokenSecret,
Version = TwitterSettings.OAuthVersion,
};
var client = new RestClient
{
Authority = "http://twitter.com/oauth",
Credentials = credentials,
HasElevatedPermissions = true
};
var request = new RestRequest
{
Path = "/statuses/update.json",
Method = WebMethod.Post
};
request.AddParameter("status", TwitterTextBox.Text);
client.BeginRequest(request, new RestCallback(TwitterPostCompleted));
}
private void TwitterPostCompleted(RestRequest request, RestResponse response, object userstate)
{
Dispatcher.BeginInvoke(() => MessageBox.Show(response.Content));
}
thanks for any help,
Sam
Ah figured it out finally I was using the wrong URL need to use:
Authority = "http://api.twitter.com" and not: "http://twitter.com/oauth"
Just in case other people find this I've written a blog post on using OAth with Hammock for Twitter. Might be of use to some people!

twitter status update using tweetsharp oauth preview 17

I am trying to update the status using tweetsharp oauth preview 17.
Please let me know how ?.
I tried this code
var msg = FluentTwitter.CreateRequest()
.AuthenticateWith(_consumerKey, _consumerSecret, Session["token"].ToString(), Session["tokensecret"].ToString())
.Statuses().Update("Hi");
but didn't work.
--Thanks
Did you submit the request? If so, what did you get back as response?
//continuing your code
var response = msg.Request();
var status = response.AsStatus();
if ( status == null )
{
var error = response.AsError();
}
if you add that code, let me know what you get back for response, status, and (if applicable) error, and I should be able to help.

Resources