gpt4 book ai didi

ios - 使用 UIImagePickerController 时应用程序在启动时崩溃

转载 作者:行者123 更新时间:2023-11-29 03:06:39 25 4
gpt4 key购买 nike

这是我的代码:

ViewController.h

@interface ViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>

@property (retain, nonatomic) IBOutlet UITextView *messageText;
@property (retain, nonatomic) IBOutlet UIImageView *imageView;

-(IBAction)selectPhoto:(UIButton*)sender;

@end

ViewController.m

-(IBAction)selectPhoto:(UIButton *)sender
{
/*
UIImagePickerController* picker = [UIImagePickerController new];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

[self presentViewController:picker animated:YES completion:NULL];
*/
}

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

//UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
//self.imageView.image = chosenImage;

//[picker dismissViewControllerAnimated:YES completion:NULL];
}


- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

//[picker dismissViewControllerAnimated:YES completion:NULL];
}

目前所有代码都被注释掉了,但应用程序仍然崩溃。如果我删除 UIImagePickerController 的两个委托(delegate),那么应用程序就不会再崩溃。

这是崩溃的屏幕截图:

enter image description here

编辑:堆栈跟踪:

* thread #3: tid = 0x1214f, 0x000000010210efcb libobjc.A.dylib`objc_msgSend + 11, queue = 'NSOperationQueue 0x10bb50dd0', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
* frame #0: 0x000000010210efcb libobjc.A.dylib`objc_msgSend + 11
frame #1: 0x0000000101cce137 Foundation`_NSDescriptionWithLocaleFunc + 41
frame #2: 0x0000000102321244 CoreFoundation`__CFStringAppendFormatCore + 7252
frame #3: 0x000000010235f913 CoreFoundation`_CFStringCreateWithFormatAndArgumentsAux + 115
frame #4: 0x00000001023bfa5b CoreFoundation`_CFLogvEx + 123
frame #5: 0x0000000101cfe276 Foundation`NSLogv + 79
frame #6: 0x0000000101cfe20a Foundation`NSLog + 148
frame #7: 0x0000000100057726 SocialApp`__28-[GPPSignIn checkSDKVersion]_block_invoke + 439
frame #8: 0x000000010006dfd4 SocialApp`-[GTMHTTPFetcher connectionDidFinishLoading:] + 714
frame #9: 0x0000000101dec36b Foundation`__65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 48
frame #10: 0x0000000101d2363b Foundation`-[NSBlockOperation main] + 75
frame #11: 0x0000000101d71d34 Foundation`-[__NSOperationInternal _start:] + 623
frame #12: 0x0000000101d73c0b Foundation`__NSOQSchedule_f + 64
frame #13: 0x0000000102aa172d libdispatch.dylib`_dispatch_client_callout + 8
frame #14: 0x0000000102a8feab libdispatch.dylib`_dispatch_async_redirect_invoke + 174
frame #15: 0x0000000102aa172d libdispatch.dylib`_dispatch_client_callout + 8
frame #16: 0x0000000102a91b27 libdispatch.dylib`_dispatch_root_queue_drain + 380
frame #17: 0x0000000102a91d12 libdispatch.dylib`_dispatch_worker_thread2 + 40
frame #18: 0x0000000102deeef8 libsystem_pthread.dylib`_pthread_wqthread + 314

最佳答案

正如您在回溯中看到的,这是一个与 google+ SDK 相关的错误:

frame #7: 0x0000000100057726 SocialApp`__28-[GPPSignIn checkSDKVersion]_block_invoke + 439

我在使用 1.5.0 版本的 SDK 时遇到了完全相同的错误。 Google 刚刚发布了修复该崩溃的 v1.5.1。

关于ios - 使用 UIImagePickerController 时应用程序在启动时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22697184/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com