使用EXC_BAD_ACCESS的NSArray obis命令的最后一个元素出错(代码= EXC_ARM_DA_ALIGN

时间:2014-02-08 06:52:59

标签: ios nsarray objective-c-blocks

当Xcode到达最后一个“"EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN"”语句以识别NSArray * objs的结束时,我收到此错误nil

我看到其他评论类似的错误herehere但这些似乎与我遇到的情况无关。我错过了一些明显的事吗?有人遇到过这种情况么?

由于

                                NSArray *keys = [NSArray arrayWithObjects:ATHLETEID, CURRENTGRADE, EVENTNAME,
                                                 PERSONALREC, SEASONSBEST, EVENTMARK, MEETDATE, MEETID, MEETNAME,
                                                 EVENTPLACE, SEASON_NAME,
                                                 SORTMARK,TYPE, RESULTID, nil];

                                NSArray *objs = [NSArray arrayWithObjects:
                                                 athleteID,
                                                 t_currentGrade,
                                                 t_eventName,
                                                 t_eventPR,
                                                 t_eventSB,
                                                 t_markInEvent,
                                                 t_meetDate,
                                                 t_meetID,
                                                 t_meetName,
                                                 t_placeInEvent,
                                                 t_currentSeason,
                                                 t_sortMark,
                                                 t_typeOfEvent,
                                                 t_uniqueResultID,nil];

                                NSMutableDictionary *resultsFromSingleMeet [[NSMutableDictionary alloc]
                                                                              initWithObjects:objs
                                                                                      forKeys:keys];

以下是我的Debug Navigator中的转储:

Thread 1, Queue : com.apple.main-thread
Thread 2, Queue : com.apple.libdispatch-manager
Thread 4, Queue : Athlete fetcher
#0  0x2e1bc79c in CFRetain ()
#1  0x2e1ca760 in +[__NSArrayI __new:::] ()
#2  0x2e1c7f04 in -[__NSPlaceholderArray initWithObjects:count:] ()
#3  0x2e1fdbdc in +[NSArray arrayWithObjects:] ()
#4  0x00034290 in __84+[MarksFromMeets(FromAthleticNet) fetchAthleteMarksIntoDatabase:whereIDofAthleteIs:]_block_invoke at /Users/Phlipo/Documents/iOS_Programming/ITrackPerformance/ITrackPerformance/MarksFromMeets+FromAthleticNet.m:293
#5  0x38ad00c2 in _dispatch_call_block_and_release ()
#6  0x38ad4e7a in _dispatch_queue_drain ()
#7  0x38ad1f92 in _dispatch_queue_invoke ()
#8  0x38ad5744 in _dispatch_root_queue_drain ()
#9  0x38ad59c4 in _dispatch_worker_thread2 ()
#10 0x38bffdfe in _pthread_wqthread ()

2 个答案:

答案 0 :(得分:1)

错误表明,您即将添加incompatible value type to the objects

  

检查(确保)对象和放大器的值。 Keys在其之前具有Object(Null Value)值   得到补充。

答案 1 :(得分:1)

我猜您正在向数组添加原始类型(例如NSUIntegerint),而不是对象。确保将所有数字包装在NSNumber对象中。