iOS7になって画面が広くはなり、正しい4:3の画面サイズになったのは嬉しい。
入れたコード
//iOS7対応
if (SYSTEM_VERSION_LESS_THAN(@"7.0"))
{
全体コード
- (void) stream: (NSStream *) theStream handleEvent: (NSStreamEvent) streamEvent
{
NSData *data;
switch (streamEvent)
{
case NSStreamEventOpenCompleted:
{
self.filesInfo = [NSMutableArray array];
self.didOpenStream = YES;
self.receivedData = [NSMutableData data];
} break;
case NSStreamEventHasBytesAvailable:
{
data = [self.streamInfo read: self];
if (data)
{
[self.receivedData appendData: data];
}
else
{
InfoLog(@"Stream opened, but failed while trying to read from it.");
[self.streamInfo streamError: self errorCode: kBRFTPClientCantReadStream];
}
}
break;
case NSStreamEventHasSpaceAvailable:
{
}
break;
case NSStreamEventErrorOccurred:
{
[self.streamInfo streamError: self errorCode: [BRRequestError errorCodeWithError: [theStream streamError]]];
InfoLog(@"%@", self.error.message);
}
break;
case NSStreamEventEndEncountered:
{
NSUInteger offset = 0;
CFIndex parsedBytes;
uint8_t *bytes = (uint8_t *)[self.receivedData bytes];
int totalbytes = [self.receivedData length];
do
{
CFDictionaryRef listingEntity = NULL;
parsedBytes = CFFTPCreateParsedResourceListing(NULL, &bytes[offset], totalbytes - offset, &listingEntity);
if (parsedBytes > 0)
{
if (listingEntity != NULL)
{
//iOS7対応
if (SYSTEM_VERSION_LESS_THAN(@"7.0"))
{
id date = [(__bridge NSDictionary *) listingEntity objectForKey: (id) kCFFTPResourceModDate];
if (CFGetRetainCount((__bridge CFTypeRef) date) >= 2)
CFRelease((__bridge CFTypeRef) date);
}
self.filesInfo = [self.filesInfo arrayByAddingObject: (__bridge_transfer NSDictionary *) listingEntity];
}
offset += parsedBytes;
}
} while (parsedBytes > 0);
[self.streamInfo streamComplete: self];
}
break;
default:
break;
}
}
0 件のコメント:
コメントを投稿