您好我正在看到这个奇怪的问题,我在for循环中填充我自己的自定义注释到mkmapview,运行for循环54次后是第55次,当我在该行上执行mkmapview addannotation时抛出EXC_BAD_ACCESS这里是代码
- (void)viewDidLoad {
[super viewDidLoad];
[mkMapView setMapType:MKMapTypeStandard];
[mkMapView setZoomEnabled:YES];
[mkMapView setShowsUserLocation:YES];
[mkMapView setScrollEnabled:YES];
MKCoordinateRegion region;
region.center.latitude = currentLocation.latitude;
region.center.longitude = currentLocation.longitude;
MKCoordinateSpan span;
span.latitudeDelta = 0.03;
span.longitudeDelta = 0.03;
region.span = span;
[mkMapView setRegion:region animated:TRUE];
[mkMapView setDelegate:self];
int i =0;
for(MyObject* myObject in myObjectArray)
{
NSLog(@"%d", i);
if(i == 55){
NSLog(@"%@", myObject);
}
i++;
NSString *maintitle = myObject.name;
NSString *subtitle = myObject.address;
CLLocationCoordinate2D newCoordinate = { [myObject.latitude doubleValue], [myObject.longitude doubleValue] };
Annotation *pinAnnotation = [[Annotation alloc]initWithCoordinate:newCoordinate title:maintitle subtitle:subtitle …Run Code Online (Sandbox Code Playgroud) 虽然MGTwitterEngine在以前版本的iOS上运行良好,但是当我尝试发布twit时,它在EXC_BAD_ACCESS失败了:
[twitter sendUpdate:textToShare];
Run Code Online (Sandbox Code Playgroud)
Objective-C代码执行器的最后一个列表是:
[theRequest prepare];
Run Code Online (Sandbox Code Playgroud)
在SA_OAuthTwitterEngine.m中.这是调用堆栈:
#1 0x00045a63 in -[OAMutableURLRequest URLEncodedString:] at /Users/ben/Dropbox/Dev/External Projects/Twitter-OAuth-iPhone/OAuthConsumeriPhoneLib/OAuthConsumerSrc/OAMutableURLRequest.m:287
#2 0x000445fa in -[OAMutableURLRequest prepare] at /Users/ben/Dropbox/Dev/External Projects/Twitter-OAuth-iPhone/OAuthConsumeriPhoneLib/OAuthConsumerSrc/OAMutableURLRequest.m:131
#3 0x00041778 in -[SA_OAuthTwitterEngine _sendRequestWithMethod:path:queryParameters:body:requestType:responseType:] at /Developer/WorkShop/XDictionary/trunk/Dictionary/Twitter+OAuth/SAOAuthTwitterEngine/SA_OAuthTwitterEngine.m:325
#4 0x000356b1 in -[MGTwitterEngine sendUpdate:inReplyTo:] at /Developer/WorkShop/XDictionary/trunk/Dictionary/Twitter+OAuth/MGTwitterEngine/MGTwitterEngine.m:1037
#5 0x0003546c in -[MGTwitterEngine sendUpdate:] ()
#6 0x00023ae7 in -[SocialNetworking twitterShare] ()
#7 0x00023c2b in -[SocialNetworking OAuthTwitterController:authenticatedWithUsername:] ()
#8 0x0003d0d5 in -[SA_OAuthTwitterController gotPin:] ()
#9 0x0003eabb in -[SA_OAuthTwitterController webViewDidFinishLoad:] ()
#10 0x0051736a in -[UIWebView webView:didFinishLoadForFrame:] ()
#11 0x00518956 in -[UIWebViewWebViewDelegate webView:didFinishLoadForFrame:] ()
#12 …Run Code Online (Sandbox Code Playgroud) 执行此行时,我在iOS中频繁出现EXC_BAD_ACCESS崩溃:
while (sqlite3_step(statement) == SQLITE_ROW) {
}
Run Code Online (Sandbox Code Playgroud)
它用于在我的(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 功能中提供结果.
有任何想法吗?SQL等看起来很好,数据库正在后台线程中更新,之后我调用前台线程来更新UI.
我有一个UIViewController班级(说它是XXX).我通过代码以模态方式呈现此视图控制器.
XXX *xxx = [ [XXX alloc] init];
[self presentModalViewController:xxx animated:YES];
[xxx release];
Run Code Online (Sandbox Code Playgroud)
我想在XXX视图的顶部添加导航栏.所以我UINavigationBar在XXX的loadView方法中使用了对象.
UINavigationBar *navBar = [ [UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
[self.view addSubview:navBar];
[navBar release];
Run Code Online (Sandbox Code Playgroud)
但是,它会抛出一个错误"EXC_BAD_ACCESS".任何帮助......?
谢谢
iphone exc-bad-access objective-c uinavigationbar uiviewcontroller
我已经声明了一个属性someProperty并合成它:
@synthesize someProperty = _someProperty;
但是当我在代码中调用它时,我在getter overide方法中获得了EXC_BAD_ACCESS.为什么??
- (NSString *) someProperty { <---EXC_BAD_ACCESS HERE
if(!self.someProperty)
return self.someOtherProperty;
return self.someProperty;
}
Run Code Online (Sandbox Code Playgroud) 如果我在方向更改期间更改UICollectionView的布局,我会EXC_BAD_ACCESS在几次旋转后得到.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
UICollectionViewLayout *layout = [[UICollectionViewFlowLayout alloc] init];
self.myCollectionView.collectionViewLayout = layout; // This causes EXC_BAD_ACCESS after a few rotations
}
Run Code Online (Sandbox Code Playgroud)
这是一个UICollectionView错误吗?或者我做错了什么?如果这是一个错误,有没有办法在方向更改期间更改整个布局?
我注意到在这个答案中提到了同样的问题.使用NSZombies进行调试不会产生其他信息.
我正在为XCode 4.6中的iOS开发.我正在为服务编写一个库,并使用boost来启动线程.我的一个方法看起来像这样:
void Service::start(boost::shared_ptr<ResultListener> listener) {
boost::future<bool> con = boost::make_future(true);
listener->onConnected(); // Works
boost::future<bool> initDone = con.then([&, listener](boost::future<bool>& connected) {
listener->onConnected(); // Works
if (!connected.get()) {
listener->onError("...");
return false;
}
listener->onError("..."); // EXC_BAD_ACCESS
/* ... */
return true;
});
}
Run Code Online (Sandbox Code Playgroud)
在设备上执行此操作时,我会EXC_BAD_ACCESS在标记的行处获得.我对此感到非常惊讶,因为第一次调用onConnected是成功的,即使我在该onError调用之前添加了一个调用if也是有效的.
由于对C++缺乏经验,我会对每一条信息感到高兴,这些信息是关于什么原因,如何调试它以及如何在下次发生此问题时如何发现.此外,我不太确定哪些信息是相关的.我所知道的可能与我迄今为止所发现的相关,以下可能是:ResultListener并且Service是boost::noncopyable.我检查了shared_ptr(使用use_count)的引用计数,它在继续中增加.我正在使用boost 1.53.这个方法就是这样调用的
Servuce reco(/* ... */);
boost::shared_ptr<foo> f(new foo());
reco.start(f);
Run Code Online (Sandbox Code Playgroud)
foo是一个简单的类,std::cout如果调用一个方法,它只会打印.
编辑:进一步窥探让我检查get()调用,我发现以下代码future.hpp正在执行:
// …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有两个视图控制器.第一个Viewcontroller是应用程序窗口的rootViewController.单击第一个ViewController中的Button时,我将第二个Viewcontroller的视图作为subView添加到第一个视图中,第二个ViewController视图中有一个Button,我的问题是当我点击该按钮时应用程序崩溃了
-(void)theCheckoutViewisExpandedwitPatient:(id)patient
{
SecondViewController *sample=[[SecondViewController alloc]init];
CGRect rect=sample.view.frame;
rect.origin.y=30;
rect.origin.x=305;
[sample.view setFrame:rect];
[self.view addSubview:[sample view]];
}
Run Code Online (Sandbox Code Playgroud) 我上传了应用程序并被拒绝说
我们发现您的应用程序在运行iOS 7的iPad上崩溃,这不符合App Store审核指南.
好吧,我上传的时间,iOS7没有启动.
崩溃报告说
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xb1b1f20b
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x3a2f5b26 objc_msgSend + 6
1 MapKit 0x30ca46a6 -[MKMapView mapViewDidFinishLoadingTiles:] + 46
2 VectorKit 0x376bbaf4 -[VKTileSource didFinishWithNetwork] + 68
3 VectorKit 0x376bc196 __32-[VKTileSource performDownload:]_block_invoke126 + 38
4 GeoServices 0x345b6fdc ___ZNK49-[GEOTileLoaderInternal _loadedTile:forKey:info:]66__49-[GEOTileLoaderInternal _loadedTile:forKey:info:]_block_invoke3$_1clERKN8LoadItem9RequesterE_block_invoke_2 + 52
5 libdispatch.dylib 0x3a7ddd78 _dispatch_call_block_and_release + 8
6 libdispatch.dylib 0x3a7ddd64 _dispatch_client_callout + 20
7 libdispatch.dylib 0x3a7e47bc _dispatch_main_queue_callback_4CF$VARIANT$mp + 264
8 CoreFoundation 0x2fab881c …Run Code Online (Sandbox Code Playgroud) 我的iPhone应用程序崩溃在客户端设备上的ios 7.0 iphone 5s我无法弄清楚它有什么问题,我正在使用crashlytics进行崩溃报告.Crashlytics报告由于线程#9 DataDetectorsCore processToken上的错误访问而崩溃
Crashed: NSOperationQueue 0x17023e120
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000620a51e24
0 DataDetectorsCore processToken + 400
1 DataDetectorsCore _DDScannerHandleState + 344
2 DataDetectorsCore _DDScannerHandleState + 344
3 DataDetectorsCore _DDScannerHandleState + 400
4 DataDetectorsCore _DDScannerHandleState + 400
5 DataDetectorsCore _DDScannerHandleState + 400
6 DataDetectorsCore _DDScannerHandleState + 400
7 DataDetectorsCore DDScannerScanQuery + 456
8 DataDetectorsUI -[DDOperation main] + 240
9 Foundation -[__NSOperationInternal _start:] + 644
10 Foundation __NSOQSchedule_f + 76
11 libdispatch.dylib _dispatch_client_callout + 16
12 libdispatch.dylib _dispatch_async_redirect_invoke + 152 …Run Code Online (Sandbox Code Playgroud) exc-bad-access ×10
iphone ×5
ios ×4
objective-c ×3
ios5 ×2
boost ×1
boost-thread ×1
c++ ×1
ios6 ×1
mkmapview ×1
sqlite ×1
xcode ×1