CoreImage / CIFilter与大图像崩溃,没有错误消息..

时间:2014-10-11 20:28:29

标签: ios objective-c ios8 core-image cifilter

将此代码与小图像一起使用时效果很好。对于大图像(6937x4630),我可以使用滑块一次(需要4-6秒才能应用滤镜,使用100MB内存)。 如果我再次尝试移动滑块(非连续),应用程序崩溃时没有出现错误消息,并将设备记录保留在下面。

如何确定应用崩溃的原因和位置? 我有什么提示可能在这里做错了吗?

设备:iPhone5S,iPhone6plus iOS8,iOS8.1 xCode 6.1GM

//
//  ViewController.m
//


#import "ViewController.h"

@interface ViewController ()

@property (nonatomic) UIImagePickerController *imagePickerController;
@property (nonatomic) UIImage *image;
@property (weak, nonatomic) IBOutlet UISlider *sliderRadius;
@property (nonatomic) CIContext *context;
@property (nonatomic) CIImage *ciImage;
@property (nonatomic) CIImage *result;
@property (nonatomic) CIFilter *filter;
@property (nonatomic) CGImageRef cgImage;
@property (nonatomic) CGRect *extent;

@end

@implementation ViewController

- (void)viewDidLoad {
    self.context = [CIContext contextWithOptions:nil];
    self.filter = [CIFilter filterWithName:@"CISepiaTone"];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)openButton:(id)sender {
    if (self.imageView.isAnimating)
    {
        [self.imageView stopAnimating];
    }

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePickerController.delegate = self;

    self.imagePickerController = imagePickerController;

    [self presentViewController:self.imagePickerController animated:YES completion:nil];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    //Original Image
    self.image = [info valueForKey:UIImagePickerControllerOriginalImage];

    //Update der imageView
    [self.imageView setImage:self.image];
    self.ciImage = [CIImage imageWithCGImage:self.image.CGImage];


    //Image Picker dismis
    [self dismissViewControllerAnimated:YES completion:NULL];

    //Filter Input Image setzen
    [self.filter setValue:self.ciImage forKey:kCIInputImageKey];

    self.imagePickerController = nil;

}

- (IBAction)filterAction:(UISlider *)slider {

    [self.filter setValue:[NSNumber numberWithFloat:self.sliderRadius.value] forKey:kCIInputIntensityKey];
    self.result = [self.filter outputImage];
    self.cgImage = [self.context createCGImage:self.result fromRect:[self.result extent]];
    [self.imageView setImage:[UIImage imageWithCGImage:self.cgImage]];

    //CFRelease(cgImage);

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissViewControllerAnimated:YES completion:NULL];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    NSLog(@"Memory");
}


@end



Incident Identifier: 72D4B88A-0F6C-4F55-AD75-D00104982F45
CrashReporter Key:   b538bd13ec68a6bf50379d388fde920bbbb30d6c
Hardware Model:      iPhone7,1
OS Version:          iPhone OS 8.1 (12B407)
Kernel Version:      Darwin Kernel Version 14.0.0: Fri Oct  3 21:56:57 PDT 2014; root:xnu-2783.3.13~2/RELEASE_ARM64_T7000
Date:                2014-10-11 21:31:36 +0200
Time since snapshot: 60 ms

Free pages:                              751
Active pages:                            66094
Inactive pages:                          32529
Speculative pages:                       632
Throttled pages:                         0
Purgeable pages:                         0
Wired pages:                             80872
File-backed pages:                       12346
Anonymous pages:                         86909
Compressions:                            18658086
Decompressions:                          8858437
Compressor Size:                         57617
Uncompressed Pages in Compressor:        116482
Page Size:                               16384
Largest process:   backboardd

Processes
     Name       |            <UUID>                |     CPU Time|     rpages|       purgeable| recent_max| lifetime_max| fds |  [reason]         | (state)

            seld <e0ef06552fcd329798c7d48e18ae7084>         0.049         220                0           -           699   50   [vm-pageshortage]   (daemon)
   nsurlsessiond <d4d92aa5748c3b228aa6c71bf229541e>        26.290        1029                0           -          2006   50   [vm-pageshortage]   (daemon)
            nfcd <5a064f82c8e93ffabc6d06ac2611a98c>         0.067         222                0           -           623   50   [vm-pageshortage]   (daemon)
     debugserver <f00a5e2ac8f73e7e893c711d88c344a6>         0.019         145                0           -           409   50   [vm-pageshortage]   (daemon)
   biometrickitd <16a81b5b73e935c69a2301bb2505cdce>         0.092         271                0           -           775   50   [vm-pageshortage]   (daemon)
     debugserver <f00a5e2ac8f73e7e893c711d88c344a6>         0.508         210                0           -           629   50   [vm-pageshortage]   (daemon)
WirelessRadioMan <e2db6c768b033dd688e0507506a519bc>         0.038          87                0           -           256   50   [vm-pageshortage]   (daemon) (idle)
      MobileMail <9ab0e94c812a35b48bfb9247ad5bc666>         1.181        2143                0           -          4751   50   [vm-pageshortage]   (resume) (continuous)
             *** <b94e665fc2e33c4b9f97511aaedf3626>         1.347         388                0           -          1189   50   [vm-pageshortage]   (daemon)
            tccd <09c47a77799f311e9760bdf727854390>         3.942         241                0           -           617   50   [vm-pageshortage]   (daemon)
             kbd <aa1af3645acd3f19a51cf8f0f61a17e4>         0.115         398                0           -          1894   50   [vm-pageshortage]   (daemon)
        Vignette <69076a7a96ed39e48aaa6383dd3ee66b>         3.015       97829                0           -         50557   50   [vm-pageshortage]   (frontmost) (resume)
            ptpd <7bbf9eda115c34f8b6f7dee2581e6c04>         0.777         998                0           -          2149   50                       (daemon)
        BTServer <0cce9d9f54343782b0cae26baed8004f>       122.069         990                0           -          1912   50                       (daemon)
     CVMCompiler <31967d90745a3fad88c894bf7c6bc584>         0.284        1901                0           -          2258   50                       (daemon)
           wifid <24888d24c6c23baea9f8596de5d8ded7>       129.627         756                0           -          1498   50                       (daemon)
       locationd <b730587126dd36e49417d0098717a911>      1354.758        4608                0           -          5111   50                       (daemon)
       lockdownd <5b49b7623bc53e7d806168d6c5427762>        21.407         438                0           -           981   50                       (daemon)
         imagent <0700045eaa803925987221760d8799ac>       138.954        1079                0           -          3195   50                       (daemon)
identityservices <579d18471dec3fd890be600ff343beef>       146.703         962                0           -          2196   50                       (daemon)
   iaptransportd <5c41df46b8de3535832ab9c2a48721db>        19.302         399                0           -           912   50                       (daemon)
         syslogd <05f6b5e5512938a892bac5af23ab1c08>       104.513         607                0           -          2673   50                       (daemon)
          powerd <854edfcea1eb331dbc2820ed8635ed91>        91.818         519                0           -           618   50                       (daemon)
            apsd <130455ed9f8e321dadcc21d9f715f0f3>       120.401        1010                0           -          1935  100                       (daemon)
        networkd <d384e27e5c6430bc83553e12172b4f32>      1850.619        1105                0           -          1689   50                       (daemon)
             vmd <d16b604704613bcabf5632c2d7ae74fe>       117.316         959                0           -          2804   50                       (daemon)
     dataaccessd <9697275f4cf83af3831861af286b477d>       193.752        2251                0           -          4272  100                       (daemon)
        sharingd <de5ec767f8fe38cb9e7221169c06fba9>        71.475        1623                0           -         12426   50                       (daemon)
    mediaserverd <4809d883646e360eb8dd8a84d4bc9806>       259.061        2970                0           -         14068   50                       (daemon)
      discoveryd <95c25671ae3c32ee8622591fd5d19761>       119.338        1715                0           -          1811  200                       (daemon)
    itunesstored <1644e3379165344589356a76a05b0b5d>        40.487        2778                0           -          4341   50                       (daemon)
            misd <fb121907dae739b3a24be61ef1752687>         0.178         193                0           -           582   50                       (daemon)
    syslog_relay <840c2bf07e5f3eb8b3365725868d032d>         1.399         114                0           -           236   50                       (daemon)
          voiced <0d309908425238479742073db2d27d7d>         0.065         292                0           -           862   50                       (daemon)
      assistantd <0219a0f42fc3370d9517675fbe60fa9d>         0.323         966                0           -          3096   50                       (daemon)
     SpringBoard <a0e9597e6bc43ee28bd8065b603b4331>        10.202        9002                0           -         37674   50                    
      backboardd <11829fb1a5ff39bb9fef92e5783c1c9f>        11.444      108040                0           -         74544   50                       (daemon)
  UserEventAgent <f05146f69d6c3541bfa548c56776ef5c>       577.460        1518                0           -          2912  200                       (daemon)
       fseventsd <391c1f7a879b369196a28e62271f1c78>        56.403         757                0           -           762   50                       (daemon)
         configd <601e4d08d81c300c9ee3f57d638d666a>       103.778         615                0           -          1120   50                       (daemon)
    fairplayd.H2 <cae337642f6d396b82ac54e72bc0e0a4>        31.603         270                0           -          1555   50                       (daemon)
       distnoted <473ac03b0d4834518e54b826db35f79b>        99.114         503                0           -           440   50                       (daemon)
   wirelessproxd <8f301e7f78c63856aaec9529ef246ccf>        27.316         293                0           -          1007   50                       (daemon)
filecoordination <29dc66b208e43e89a6fb6c88b8aad6e6>         5.617         478                0           -           987  100                       (daemon)
discoveryd_helpe <7b0af17b203838bd9a48ed7430b3c576>         0.107         155                0           -           752   50                       (daemon)
         DTPower <b82e79ddecb8373a9fb08e0b7b5befa1>         0.112         280                0           -           827   50                       (daemon)
      assertiond <b1d9ebb401d43e4598dce9eada251445>        13.057         375                0           -           776   50                       (daemon)
      aggregated <ff9b9ccc22fc3f5ba6d69ec4539569a1>       377.191        1886                0           -          2183   50                       (daemon)
      DTMobileIS <2fdc94aa5069338e815fbe3a13e3d95c>       100.766        2090                0           -         20786   50                       (daemon)
   callservicesd <53b377fe33f3310d8af76a5f8ec05fe1>         0.212         590                0           -          1780   50                       (daemon)
     touchsetupd <6d8af03089e93d99b824ef2bcf15f06e>         1.053         197                0           -           682   50                       (daemon)
        cfprefsd <9006298e365a3a03b8403196ba98d29b>         0.416         295                0           -           586   50                       (daemon)
      CommCenter <af67e6c7fea03ccea0591411851e302b>        88.580        1910                0           -          5400   50                       (daemon)
         notifyd <5fa8fd5e44c83f64be1475b882b16c82>       159.142         473                0           -           436   50                       (daemon)
     ReportCrash <b0b4cd3f17083b0ebf75c0ad5679fba9>         0.060         177                0           -           614   50                       (daemon)

**End**

0 个答案:

没有答案