{"action":"opened","issue":{"url":"https://api.github.com/repos/steipete/Aspects/issues/36","labels_url":"https://api.github.com/repos/steipete/Aspects/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/steipete/Aspects/issues/36/comments","events_url":"https://api.github.com/repos/steipete/Aspects/issues/36/events","html_url":"https://github.com/steipete/Aspects/issues/36","id":53609623,"number":36,"title":"Aspects don't intercept the methods of NSFileHandle ","user":{"login":"dhekrazaied","id":756980,"avatar_url":"https://avatars.githubusercontent.com/u/756980?v=3","gravatar_id":"","url":"https://api.github.com/users/dhekrazaied","html_url":"https://github.com/dhekrazaied","followers_url":"https://api.github.com/users/dhekrazaied/followers","following_url":"https://api.github.com/users/dhekrazaied/following{/other_user}","gists_url":"https://api.github.com/users/dhekrazaied/gists{/gist_id}","starred_url":"https://api.github.com/users/dhekrazaied/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhekrazaied/subscriptions","organizations_url":"https://api.github.com/users/dhekrazaied/orgs","repos_url":"https://api.github.com/users/dhekrazaied/repos","events_url":"https://api.github.com/users/dhekrazaied/events{/privacy}","received_events_url":"https://api.github.com/users/dhekrazaied/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-07T08:41:17Z","updated_at":"2015-01-07T08:41:17Z","closed_at":null,"body":"Hello,\r\nI tried to intercept the methods of NSFileHandle like that :\r\n\r\n\r\n\r\n[NSFileHandle  aspect_hookSelector:@selector(writeData:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info, NSData *data){\r\n        NSLog(@\"writeData: after | object:%@ | instance:%@ | class:%@\",info,[info instance],[[info instance] class]);\r\n        \r\n        \r\n        \r\n    } error:NULL];\r\n    [NSFileHandle aspect_hookSelector:@selector(writeData:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> info, NSString *data){\r\n        NSLog(@\"writeData: before | object:%@ | instance:%@ | class:%@\",info,[info instance],[[info instance] class]);\r\n        \r\n        \r\n        \r\n    } error:NULL];\r\n    \r\n  NSString *docPath=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];\r\n    NSString *filePath=[docPath stringByAppendingPathComponent:@\"test.json\"];\r\n    NSString *resultLine=[NSString stringWithFormat:@\"coucou c dhekra\"];\r\n    NSString *newFilePath = [NSHomeDirectory()  stringByAppendingPathComponent:@\"/Documents/test.json\"];\r\n    NSFileHandle *handler = [NSFileHandle fileHandleForUpdatingAtPath:filePath];\r\n    NSLog(@\"newFilePath %@ %@\",newFilePath,[resultLine dataUsingEncoding:NSUTF8StringEncoding]);\r\n    if(!handler) {\r\n        handler= [NSFileHandle fileHandleForWritingAtPath:newFilePath];\r\n    }\r\n    [handler seekToEndOfFile];\r\n    [handler writeData:[resultLine dataUsingEncoding:NSUTF8StringEncoding]];\r\n\r\n\r\n But i didn't have a result why??"}}