我知道iPad上的圖片選取器需要成爲彈出式廣告素材,並且我一直在嘗試,但當我點擊調用彈出式廣告素材的按鈕時,它將無法正常工作並崩潰。ipad上的圖片選取器
-(IBAction)addPhoto:(id)sender{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
popover=[[UIPopoverController alloc]
initWithContentViewController:imagePicker];
[popover presentPopoverFromRect:((UIButton *)sender).frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo {
// Delete any existing image.
NSManagedObject *oldImage = imageClass.image;
if (oldImage != nil) {
[imageClass.managedObjectContext deleteObject:oldImage];
}
// Create an image object for the new image.
NSManagedObject *myImage = [NSEntityDescription insertNewObjectForEntityForName:@"Image" inManagedObjectContext:imageClass.managedObjectContext];
imageClass.image = myImage;
// Set the image for the image managed object.
[image setValue:selectedImage forKey:@"image"];
[self dismissViewControllerAnimated:YES completion:nil];
}
哪部分不起作用? – Joe
它崩潰的第二我點擊應該顯示彈出式窗口的按鈕 – user1858163
什麼是在backtrace? – nielsbot