Safely set the copies property

This commit is contained in:
Sebastián Katzer 2019-02-13 12:08:03 +01:00
parent fa00761d3c
commit 4bba693cd5

View File

@ -21,6 +21,8 @@
#include "APPPrinterInfo.h" #include "APPPrinterInfo.h"
#import <objc/message.h>
@implementation APPPrinterInfo @implementation APPPrinterInfo
#pragma mark - #pragma mark -
@ -71,7 +73,10 @@
info.duplex = UIPrintInfoDuplexNone; info.duplex = UIPrintInfoDuplexNone;
} }
if (class_getProperty(info.class, "copies"))
{
[info setValue:[NSNumber numberWithLong:copies] forKey:@"_copies"]; [info setValue:[NSNumber numberWithLong:copies] forKey:@"_copies"];
}
if (jobName) if (jobName)
{ {