failed to create oob message? - objective-c

Hi I'm trying to build a simple chat client between two ipod touches Just as a start to learning Bonjour.
I connect the two devices fine and everything seems like it should work. I can send the data with no problems (no error) , but When I should then receive the data and I dont. When I look in the log, I see "GCKSessionEvent_IncomingOOBPacket: failed to create oob message" I've tried
Googling ever piece of that message looking for some answer but there are literally 0 results. I was hoping someone here might have an answer.
thanks
KC
Response to comment:
The three calls are
-(IBAction)SendMessage
{
NSData* aData = [[NSData alloc] initWithData:[typeText.text dataUsingEncoding: NSUTF8StringEncoding]];
NSUTF8StringEncoding];
[self sendDataToPeers:aData];
}
-(void)sendDataToPeers:(NSData*)data
{
NSError* err;
BOOL didSend = [self.mySession sendDataToAllPeers:data withDataMode:GKSendDataReliable error:&err];
}
-(void) receiveData:(NSData*)data fromPeer:(NSString*)peer inSession:(GKSession*)session context:(void*)context
{
NSString* text = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]autorelease];
self.displayText.text = text;
}

I am also doing iphone to iphone with Wifi and GKSession. After aborted sessions (aka debugging or crash) Bonjour (or GKsessions) seem to get confused and this same scenario happens to me. With OS 3.x there was no message, just the hang. With OS 4.x I get the message "GCKSessionEvent_IncomingOOBPacket...". I have no idea what this means, but restarting the GKsession or reconnecting or sometimes just waiting solve the problem. I suspect might be a buffer full on outbound data due to messed up peers/receivers.

Kendrick, assuming you are using the 4.0 SDK, then you may be SOL on this. GKSession has a number of show-stopper bugs in the 4.0 SDK (crashes, errors, slowness) that were introduced recently. This message is due to one of them. I know because I was about to submit my GameKit app when they released 4.0 and now I'm waiting for 4.1 so I can submit it. The 4.1 Beta does fix a number of these issues, but it still doesn't work the way it worked on 3.1.3, sadly.

Related

Philips Hue API: Remove application/username from bridge in order to start over

I'm using the HueSDK_iOS and everything seems to work fine.
I have one simple question for which I cannot seem to find a simple answer.
I want to test my app's functionality whenever a new user installs it.
I cannot find a proper way to de-authenticate my app from the bridge, so it will ask again to search for bridges etc and I can start over, to test everything.
I /did/ use :
cache = [PHBridgeResourcesReader readBridgeResourcesCache];
PHBridgeConfiguration *config = [cache bridgeConfiguration];
PHBridgeSendAPI *sendAPI = [[PHBridgeSendAPI alloc] init];
[sendAPI removeWhitelistEntryWithUsername:[config username] completionHandler:^(NSArray *errors) {
...
}];
and in the first time, it returns no errors, but I still am authenticated and can use the API , control lights etc, no notification arrives for disconnection or noLocalConnection.
If I run it again, I get an error: error = {\n address = \"/config/whitelist/_a_user_name\";\n description = \"resource, /config/whitelist/_a_user_name, not available\";\n type = 3;\n
(where a "_a_user_name" is the automatically generated username)
but I still keep being authenticated to the bridge.
So it seems it does delete the username from the whitelist, but still everything works as if I was authenticated.
So the question is simple: How do I remove my app from the bridge so I can start over and test all the steps? (Pushlinking etc)
It appears it is a bug in the bridge software as I was informed by Philips API support. They asked me to wait for an update.
According to this it can only be done through https://account.meethue.com/apps starting with API version 1.31.0.

NSURLConnection timing out on iOS8

I have been working on an application involving client-server communication. Everything was working fine until iOS 7.1. Now that Xcode 6 GM Seed in launched, I tried to build and run the project on iOS8 simulator. However, all NSURLConnections seem to time out now. I can not get any response from the server. This works on iOS 7 simulator and Xcode 6.
I tried using the NSURLSession hoping that would resolve the issue. But it hasnt.
Any help will be highly appreciated!! If anyone else has faced this issue, please let me know if you have any workaround to this.
UPDATE:
This is the code I have used:
NSString *authStr = [NSString stringWithFormat:#"%#:%#", username, password];
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat: #"Basic %#",[authData base64EncodedStringWithOptions:0]];
[inURLRequest setValue:authValue forHTTPHeaderField:#"Authorization"];
Please note that the inURLRequest is already iniatlized with the desired URL.
After this just use the inURLRequest to fire the transaction as usual. For eg., in case of NSURLSession, create a download task using this request object and call resume API on it.
Well, I have found a fix for this issue.
The app had basic authentication in place for each REST webservice. This means that we used to get an authentication challenge for each webservice where we sent the credentials back with the challenge.
I changed this to send the credentials in the request header (in encrypted format) as a header field.
I am not sure how this was working in iOS 7 and not in iOS 8. But this seems to have fixed my problem :).
If you are streaming data to the NSURLConnection make sure you write new data exactly once when the stream event hasSpaceAvail has arrived - I found I had connection issues when I had wrong handling of the hasSpaceAvail event.
do not write more than once in response to the event
do not write zero times (or else you won't get another hasSpaceAvail event)

IOS Facebook SDK can't get User info after log in

Alright, I am having a devil of a time with getting some basic user info from the Facebook IOS SDK (3.1.1). Having done FB development with other platforms I am pretty convinced my issue has to do with the FB app's set up than with my code. BTW, I am in iTunes and have set an iTunes ID for iPhone. I have also carefully checked and quadruple checked the bundle ID in the App set up against my bundle ID.
Right now I can authenticate with a test user and get all the detail, etc. It works great. When I log in as a real user like myself (and I am a developer on the project) I get an Auth token, but calls to get the user fail, and I'm not sure what I have done wrong (if it works for a test user it should work for everyone).
All I need to get from the user, BTW is their First name, Last name, FB User ID, and email address (optional, but requested).
Currently after authenticating using the I'm using the games tutorial. Once I am logged in I do the following (although I have done a bunch of other things with the same result):
- (void)fbDidLogin
{
// removed the setup for the class level Facebook var that I am currently not using
// get information about the currently logged in user
NSString *fql = #"select uid, first_name, last_name, email from user where uid = me()";
NSDictionary *queryParam = [NSDictionary dictionaryWithObjectsAndKeys:fql, #"q", nil];
[FBRequestConnection startWithGraphPath:#"/fql"
parameters:queryParam
HTTPMethod: #"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
[self meRequestResult:result WithError:error];
}];
}
The meRequestResult routine starts like this:
- (void)meRequestResult:(id)result WithError:(NSError *)error
{
if ([result isKindOfClass:[NSDictionary class]])
{
NSDictionary *dictionary;
if([result objectForKey:#"data"])
dictionary = (NSDictionary *)[(NSArray *)[result objectForKey:#"data"] objectAtIndex:0];
else
dictionary = (NSDictionary *)result;
[fbUserData release];
fbUserData = [dictionary retain];
NSString *facebookId = [dictionary objectForKey:#"id"];
if(!facebookId)
facebookId = [dictionary objectForKey:#"uid"];
// and more follows that is not pertinent
When I turn on request logging in the FB IOS SDK. I see the same things and can not find any description anywhere what these mean.
Here's the last 10 or so lines from the log:
2012-12-03 11:52:12.394 mTender[6572:1cd03] Reachability Flag Status: -R -----l- networkStatusForFlags
2012-12-03 11:52:12.395 mTender[6572:1cd03] The internet is working via WIFI.
2012-12-03 11:52:12.396 mTender[6572:1cd03] Reachability Flag Status: -R ------- networkStatusForFlags
2012-12-03 11:52:12.396 mTender[6572:1cd03] A gateway to the host server is working via WIFI.
2012-12-03 11:52:35.093 mTender[6572:1cd03] FBSDKLog: Request <#1111>:
URL: https://graph.facebook.com//fql?sdk=ios&access_token=ACCESS_TOKEN_REMOVED&q=select%20uid%2C%20first_name%2C%20last_name%2C%20email%20%20from%20user%20where%20uid%20%3D%20me%28%29&migration_bundle=fbsdk%3A20121003&format=json
Method: GET
UserAgent: FBiOSSDK.3.1.1
MIME: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
2012-12-03 11:52:37.194 mTender[6572:1cd03] Error: HTTP status code: 500
2012-12-03 11:52:37.196 mTender[6572:1cd03] FBSDKLog: Response <#1111> <Error>:
The operation couldn’t be completed. (com.facebook.sdk error 5.)
Hopefully someone can figure this out. It's the last step of this project..
I am doing something very similar to you. I am using facebook for login so that I don't have to worry about storing passwords and what not.
I followed this set of instructions.. The facebook site seems to be horrid the way its layed out with out of date stuff all over the place.
You can use native facebook or web based user authentication (the SDK will manage all that) so it will work on older versions of iOS and when not signed in to native facebook.
You will set a handler which will give you a "NSDictionary *user" with all the stuff that you need. No need to use the graph api on the iphone client.
i think you have to see alternate way because the REST API has been deprecated. To make FQL queries you have to use the Graph API call.
http://developers.facebook.com/docs/reference/rest/fql.query/
OK, I'm going to close this out.
I reverted to an SDK back in November of 2011. It didn't seem to be working at first, and then it just started working. I suspect a bug on Facebook's end was causing this. I haven't updated to the latest again to try, but this is my only guess as to what happened.
If you've done any lengthy Facebook development you know that sometimes their bugs really make things difficult. That said, no idea if this is the actual answer since I really didn't make any coding changes from the original code.
I know that I purposefully left the bundle ID out of the FB App Setup..

Strange SyncServices / iSync console messages when saving ABAddressBook

I'm displaying and editing an ABPerson with an ABPersonView. I do this like so:
ABPerson *person = (ABPerson *)[_addressBook recordForUniqueId:[curDict valueForKey:#"id"]];
[_personView setPerson:person];
[_personView setEditing:YES];
Where _personView is my ABPersonView. When I edit the ABPerson with the ABPersonView and I save the AddressBook:
[ABAddressBook addressBook] save];
It does save and in the AddressBook application I can see its value has changed, but I get these error messages in Xcode and Console:
I first get this:
sandboxd: ([3082]) AddressBookSync(3082) deny file-read-data /Users/xcodeuser/Library/Developer/Xcode/DerivedData/CompanyName-asdxadsafadfqmwqxaagdsfgafguge/Build/Products/Debug
Followed by a lot of this:
sandboxd: ([3035]) AddressBookSync(3035) deny mach-lookup com.apple.syncservices.SyncServer
And it ends with this:
AddressBookSync[3035:707] [0x10011ba50] |ISyncManager|Warning| SyncServer is unavailable: timed out trying to connect
AddressBookSync[3035:707] AddressBookSync (client id: com.apple.AddressBook) error: Exception running AddressBookSync: Timed out waiting for the sync server
AddressBookSync exited with 2
My application is sandboxed and I integrated iCloud.
I have searched but could not find anyone having the same kind of problems, I have tried this:
Using [[ABAddressBook] sharedAddressBook] instead of [[ABAddressBook] addressBook] but I then get an error from the ABPersonView saying the use of sharedAddressBook is deprecated with the ABPersonView.
I added SyncServices framework, didn't help
The code does work though, at least with my iCloud account. Anyone got a clue to why I'm getting these errors? Is it worth a shot trying it with Xcode 4.3 and 10.8? I'm currently running 4.2.1 with Lion.
Thanks!
I've seen exactly this same problem. I believe you are seeing a bug in the Apple frameework.

ASIFormDataRequest unable to upload .zip file from device but does it in simulator

I have wifi connected in the devices - so this is ruled out.
The Application i have with the same following code executed is able to upload the file to a java server in the iOS 4.3 simulator but unable to upload in iOS 4.3.3 device. This is kind of strange.
ASIFormDataRequest *request_zip = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:strURL]];
[request_zip setAllowCompressedResponse:YES];
[request_zip setPostValue:#"device" forKey:#"value1"]; //pass device ID here...
//[request_zip addRequestHeader:#"Content-Type" value:#"multipart/form-data"];
[request_zip setTimeOutSeconds:20];
[request_zip setDelegate:self];
[request_zip setDidFailSelector:#selector(uploadFailed:)];
[request_zip setDidFinishSelector:#selector(uploadFinished:)];
[request_zip setFile:path forKey:path];
[request_zip startAsynchronous];
NSLog(#"%# post length",[NSString stringWithFormat:#"%llu",[request_zip postLength]]);
The code when executed results the following output in the terminal.
Incorrect NSStringEncoding value 0x0000 detected. Assuming NSStringEncodingASCII. Will stop this compatiblity mapping behavior in the near future.
The post length printed in the console =>
0 post length
There is also a another string comes up lastly, i.e the time out message,
Request failed:
The request timed out with response data
100% sure that the server is active and responds immediately for the app executed from simulator.
how is it possible to have a program running in simulator properly but not in the device?
Incorrect NSStringEncoding value
0x0000 detected. Assuming
NSStringEncodingASCII. Will stop this
compatiblity mapping behavior in the
near future.
Means that you have a NSString that is being initalized without a NSStringEncoding value, check your NSString calls.
Empty body in POST in ASIHTTPRequest
Try:
NSURL *requestURL = [NSURL URLWithString:[NSString stringWithFormat:#"%#", strURL]];
ASIFormDataRequest *request_zip = [ASIFormDataRequest requestWithURL:requestURL];
The NSLog will fire right after the [request_zip startAsynchronous]; which at that time may just be initialized, you need to move the log request into a delegate method, change this to [request_zip startSynchronous]; and it will fire immediately,.
Then your delegate method will look like this:
- (void)requestStarted:(ASIHTTPRequest *)request {
NSLog(#"%# post length",[NSString stringWithFormat:#"%llu",[request postLength]]);
}
The problem was with the server end. ASIHTTP lib works properly, when ASI tries to transmit the request with post body to server, the apache didnt respond back properly as one of the server configuration was missing probably. The proprietary web library owners fixed it later and the problem is resolved.
It worked in simulator but not in device, why?
It worked in simulator coz the data is transmitted thru the ethernet not wireless, so the transmission rates were great comparatively.
Web service developers has to plz make sure that the data is received even
if it comes in from low speed networks
**
ASI libs returned ASCII encoding error, why?
**
This error is returned by ASI immediately once the request goes time - out. This is the cause, but the real internal problem with ASI for this error has to be found out.
Very interesting results fetched end of the day.