ConnectionID is in incorrect formate. SignalR - ios

I usesignalR latest library. I downloaded signalR library from gitHub SignalR gitHub link and installed pod file in my app. I am working on iOS end. I don't know about asp.net. The only url is provided to me for integration. Here is my code
__weak SRConnection *connection = [SRConnection connectionWithURL:SIGNALR_PATH];
[connection addValue:[[NSUserDefaults standardUserDefaults] objectForKey:kAccessToken] forHTTPHeaderField:#"MyAuthentication"];
connection.received = ^(NSString * data) {
NSLog(#"%#",data);
};
connection.started = ^{
[connection send:#"hello world"];
};
[connection start];
Connection open successfully but When I get try to send message it gives me an error "The ConnectionId is in incorrect format".
I am using latest library of signalR. I don't know what I need to authorised. Is only url enough for that? Or will need to add accessToken that I get on login?.
Please help me what I need for integrating signalR. I searched a lot but couldn't find any clear information.

Related

iOS Pusher doesn't work, client not connecting

This is for www.pusher.com.
iOS lib they provided is libPusher. After I installed and follow the first step, it just not working. I've heard a few people make it work. Is this library still alive or it doesn't support newer version of iOS?
PTPusher *client = [PTPusher pusherWithKey:#"app-key" delegate:self encrypted:NO]; // I assume this is "key" not "secret" there.
[client connect];
PTPusherChannel *channel = [client subscribeToChannelNamed:#"test"];
NSLog(#"Channel: %#, %d", channel, channel.isSubscribed);
I've implemented delegate methods to track status. After [client connect] called, the delegate method: - (BOOL)pusher:(PTPusher *)pusher connectionWillConnect:(PTPusherConnection *)connection trigged, but then nothing happened after this. No error messages, no success messages. Since the clint is not connecting, the channel is not subscribed either.
I've implemented pusher on JS and it worked. Since what I did is very basic client connection and there is nothing I can do about (At least from documents), so I assume maybe this library just not working anymore.
I was being dumb and ignored that the document said pusher client should be strong. Therefore, the solution should be:
#property(nonatomic) PTPusher *client;
self.client = [PTPusher ...];
...

Objective C - DropboxSDK: (401) Authentication failed -

I'm using the dropbox SDK to save file to a user's dropbox account.
When the user taps 'save to dropbox' button for the first time, a popup window pops up and the user is required to login onto their dropbox account. I then upload a file to their dropbox account using uploadFile method provided by the SDK. However, the first time, it gives me the error:
DropboxSDK: error making request to /1/files_put/dropbox/sampleFile.pdf - (401) Authentication failed
When I close the app and try again, it successfully uploads the file.
What may be causing the app to behave so strangely?
I had the same issue and it turned out that I initialized my DBRestClient from viewDidLoad like the Dropbox docs say, but since that happens before the dropbox account is linked the restClient is not properly set.
This can be easily fixed re-initializing your restClient or even better by using the following way to access your restClient.
-(DBRestClient*)restClient{
if(_restClient == nil){
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
[_restClient setDelegate:self];
}
return _restClient;
}
I got same error, use this code in your app hope this will help you.
if([[DBSession sharedSession] isLinked])
{
//Do your drop box work here...
}
else
{
//If not linked then start linking here..
[[DBSession sharedSession] linkFromController:self];
}

PayPal Error when remove setEnviroment

I am implementing the PayPal SDK. Here is my code:
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentNoNetwork];
PayPalPaymentViewController *paymentViewController;
paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId
receiverEmail:kPayPalReceiverEmail
payerId:nil
payment:payment
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
Everything works fine but when I remove:
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentNoNetwork];
I get this error message:
Request has failed with error:"invalid_client - System error (invalid_client). Please try again later.
details: (
{
"error_description" = "The client credentials are invalid";
}
)"
and an alertview pops up:
Any help will be appreciated.
Thank you!
When you remove "noNetwork" environment, the SDK attempts to communicate with the PayPal servers using the clientId from your code. The default environment is production. Make sure you are including the clientId for Live in your code. You can also set the environment to use sandbox as well, which requires a different clientId. You can get these clientIds at https://developer.paypal.com/

Upload file via Soap message using MTOM in iOS

I have found here Upload file via Soap message in detail. But i have another issue if there is large file in Soap then it creates memory issues cause of file loads in memory for sending via Soap message.
I read about MTOM (Message Transmission Optimisation Mechanism). "When you use MTOM/XOP to optimise a SOAP message, the XOP processing serialises it into a MIME Multipart/Related message. The XOP processing extracts the base64Binary data from the SOAP message and packages it as separate binary attachments within the MIME message, in a similar manner to e-mail attachments"
I have found how to use this approach in java here Soap with Attachments and MTOM in Java
Now i have two questions :-
By using MTOM/XOP approach in iOS we can reduce Or solve the
issue of memory as explaind above.
In programming How we can use MTOM/XOP approach in iOS.
Any help will be appriciated.Thanks in advance.
I have done same request using the Rest Kit.Rest kit allows to send attachment in MTOM Specification.
First thing you need is to download Restkit.
Following is the code snippet for the MTOM using the RestKit.
abv.h
#import "RestKit/RestKit.h"
RKObjectManager *man;
RKObjectLoader *loader;
abc.m
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
//Start Progress bar
RKParams * params = [[RKParams alloc] init];
UIImage *image=[UIImage imageNamed:#"zbar-samples.png"];
RKObjectManager *man;
NSData * fileData=UIImageJPEGRepresentation(image,0.7);
[params setValue:#"1234" forParam:#"encryptedToken"];
[params setValue:modelObj.docNameTobeSent
forParam:#"documentName"];
RKParamsAttachment * attachments = [params setData:fileData forParam:#"file"];
[attachments setMIMEType:#"image/jpeg"];
[attachments setFileName:[NSString stringWithFormat:#"%#.jpeg",modelObj.name]];
self.man = [RKObjectManager objectManagerWithBaseURL:YOUR URL];
self.loader = [self.man loadObjectsAtResourcePathUsingPOSTRPC:#"upload.form" objectMapping:nil PostParams:params delegate:self];
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error
{
//Handle fail error
//stop Progress bar
}
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects
{
NSLog(#"%#",#"didLoadObjects");
}
- (void)objectLoaderDidFinishLoading:(RKObjectLoader*)objectLoader
{
NSLog(#"%#",#"objectLoaderDidFinishLoading");
//stop Progress bar
}
- (void)objectLoaderDidLoadUnexpectedResponse:(RKObjectLoader*)objectLoader
{
NSLog(#"%#",#"objectLoaderDidLoadUnexpectedResponse");
//stop Progress bar
}

Trouble connecting to a google apps server via MailCore

I'm trying to connect to Google Apps email server via IMAP. The code I am using below, every time I try to connect I get the error: Parse error Anyone know the source of this error?
int port = 993;
CTCoreAccount *account = [[CTCoreAccount alloc] init];
BOOL success = [account connectToServer:#"imap.gmail.com"
port:port
connectionType:CTConnectionTypeStartTLS
authType:CTImapAuthTypePlain
login:login
password:password];
NSLog(#"Port: %d",port);
if (!success) {
NSLog(#"Connection failed, error: %#",[account.lastError localizedDescription]);
}
else {
NSLog(#"Connection succeeded");
}
There were two issues simultaneously going on here. The first was that my network had a firewall and that was the source of the Parse Error.
Second, when you need to connect to Google Maps IMAP server, you'll need to use the CTConnectionTypeTLS instead of CTConnectionTypeStartTLS, because the second one makes the server go bonkers.

Resources