@@ -178,15 +178,15 @@ - (void)flexibleToolbarContainerDidHide:(PSPDFFlexibleToolbarContainer *)contain
178178 return @{@" annotations" : annotationsJSON};
179179}
180180
181- - (void )addAnnotation : (id )jsonAnnotation {
181+ - (BOOL )addAnnotation : (id )jsonAnnotation {
182182 NSData *data;
183183 if ([jsonAnnotation isKindOfClass: NSString .class]) {
184184 data = [jsonAnnotation dataUsingEncoding: NSUTF8StringEncoding];
185185 } else if ([jsonAnnotation isKindOfClass: NSDictionary .class]) {
186186 data = [NSJSONSerialization dataWithJSONObject: jsonAnnotation options: 0 error: nil ];
187187 } else {
188188 NSLog (@" Invalid JSON Annotation." );
189- return ;
189+ return NO ;
190190 }
191191
192192 PSPDFDocument *document = self.pdfController .document ;
@@ -201,17 +201,19 @@ - (void)addAnnotation:(id)jsonAnnotation {
201201 if (!success) {
202202 NSLog (@" Failed to add annotation." );
203203 }
204+
205+ return success;
204206}
205207
206- - (void )removeAnnotation : (id )jsonAnnotation {
208+ - (BOOL )removeAnnotation : (id )jsonAnnotation {
207209 NSData *data;
208210 if ([jsonAnnotation isKindOfClass: NSString .class]) {
209211 data = [jsonAnnotation dataUsingEncoding: NSUTF8StringEncoding];
210212 } else if ([jsonAnnotation isKindOfClass: NSDictionary .class]) {
211213 data = [NSJSONSerialization dataWithJSONObject: jsonAnnotation options: 0 error: nil ];
212214 } else {
213215 NSLog (@" Invalid JSON Annotation." );
214- return ;
216+ return NO ;
215217 }
216218
217219 PSPDFDocument *document = self.pdfController .document ;
@@ -232,6 +234,7 @@ - (void)removeAnnotation:(id)jsonAnnotation {
232234 if (!success) {
233235 NSLog (@" Failed to remove annotation." );
234236 }
237+ return success;
235238}
236239
237240- (NSDictionary <NSString *, NSArray<NSDictionary *> *> *)getAllUnsavedAnnotations {
@@ -241,15 +244,15 @@ - (void)removeAnnotation:(id)jsonAnnotation {
241244 return annotationsJSON;
242245}
243246
244- - (void )addAnnotations : (id )jsonAnnotations {
247+ - (BOOL )addAnnotations : (id )jsonAnnotations {
245248 NSData *data;
246249 if ([jsonAnnotations isKindOfClass: NSString .class]) {
247250 data = [jsonAnnotations dataUsingEncoding: NSUTF8StringEncoding];
248251 } else if ([jsonAnnotations isKindOfClass: NSDictionary .class]) {
249252 data = [NSJSONSerialization dataWithJSONObject: jsonAnnotations options: 0 error: nil ];;
250253 } else {
251254 NSLog (@" Invalid JSON Annotations." );
252- return ;
255+ return NO ;
253256 }
254257
255258 PSPDFDataContainerProvider *dataContainerProvider = [[PSPDFDataContainerProvider alloc ] initWithData: data];
@@ -259,6 +262,8 @@ - (void)addAnnotations:(id)jsonAnnotations {
259262 if (!success) {
260263 NSLog (@" Failed to add annotations." );
261264 }
265+
266+ return success;
262267}
263268
264269#pragma mark - Forms
0 commit comments