how to listen event 'did change my data'
how to listen event 'did change my data'
- Subject: how to listen event 'did change my data'
- From: Carlo Gulliani <email@hidden>
- Date: Sat, 21 Feb 2009 10:18:55 -0800 (PST)
I'm trying to modify apple's examples: Picture Sharing and Picture Sharing Browser
I creating iphone's app, which is my server side (Picture Sharing), also i creating standalone's app, which is client side (Picture Sharing Browser), which i launched on my mac.
It works great, but when i sent data from my iphone to my mac's app i should press button for changing my data. For example, i sent the next data from iphone:
- (void)connectionReceived:(NSNotification *)aNotification {
NSFileHandle* incomingConnection = [[aNotification userInfo] objectForKey:NSFileHandleNotificationFileHandleItem];
NSString *s = @"something...";
const char *utfMyString = [s UTF8String];
NSData *representationToSend = [NSData dataWithBytes:utfMyString length:strlen(utfMyString)];
[[aNotification object] acceptConnectionInBackgroundAndNotify];
[incomingConnection writeData:representationToSend];
[incomingConnection closeFile];
numberOfDownloads++;
}
My app has the next code:
- (IBAction)serviceClicked:(id)sender
{
int index = 0;
if(serviceBeingResolved) {
[serviceBeingResolved stop];
[serviceBeingResolved release];
serviceBeingResolved = nil;
}
if(-1 == index) {
NSLog(@"");
} else {
serviceBeingResolved= [servicesobjectAtIndex:index];
[serviceBeingResolvedretain];
[serviceBeingResolvedsetDelegate:self];
[serviceBeingResolvedresolve];
}
}
...
- (void)readAllTheData:(NSNotification *)note
{
NSData*data = [[note userInfo] objectForKey:@"NSFileHandleNotificationDataItem"];
NSString*string = [NSStringstringWithCString:[data bytes] length:[data length]];
[txt setString:string];
[[NSNotificationCenterdefaultCenter] removeObserver:selfname:NSFileHandleReadToEndOfFileCompletionNotificationobject:[note object]];
[[note object] release];
}
How can i use some event, which will be call serviceClicked when my app did receive any message from iphone
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden