我有一个只在 IOS 7 中发生的崩溃,我无法重现它,但它经常发生。有人有答案或至少知道问题出在哪里吗? 我已经删除了所有关于 ios7 的警告,但崩溃仍然发生。 附上日志。
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3b43c626 objc_msgSend + 5
1 Foundation 0x315a9681 -[NSConcreteMapTable assign:key:value:isNew:] + 68
2 Foundation 0x315a95fb -[NSConcreteMapTable setObject:forKey:] + 82
3 Foundation 0x315ecaf7 -[NSISEngine setRowWithHead:body:] + 30
4 Foundation 0x315ef5d1 -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 388
5 Foundation 0x315ed325 -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 236
6 Foundation 0x315efd9f -[NSISEngine tryUsingArtificialVariableToAddConstraintWithMarker:rowBody:usingInfeasibilityHandlingBehavior:mutuallyExclusiveConstraints:] + 226
7 Foundation 0x315eb5fd -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 692
8 Foundation 0x315eb23b -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 286
9 Foundation 0x315e8f6d -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 232
10 Foundation 0x315f47ed -[NSLayoutConstraint _addToEngine:] + 28
11 UIKit 0x33591c55 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 332
12 Foundation 0x315e8b2b -[NSISEngine withBehaviors:performModifications:] + 210
13 UIKit 0x33591ad9 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 336
14 UIKit 0x3349e20d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 200
15 UIKit 0x33591bbb __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 178
16 Foundation 0x315e8b2b -[NSISEngine withBehaviors:performModifications:] + 210
17 UIKit 0x33591ad9 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 336
18 UIKit 0x3349e20d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 200
19 UIKit 0x33591bbb __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 178
20 Foundation 0x315e8b2b -[NSISEngine withBehaviors:performModifications:] + 210
21 UIKit 0x33591ad9 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 336
22 UIKit 0x3349e20d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 200
23 UIKit 0x33591bbb __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 178
24 Foundation 0x315e8b2b -[NSISEngine withBehaviors:performModifications:] + 210
25 UIKit 0x33591ad9 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 336
26 UIKit 0x3349e20d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 200
27 UIKit 0x3349de33 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 82
28 Foundation 0x315e8b2b -[NSISEngine withBehaviors:performModifications:] + 210
29 UIKit 0x3349dcd3 -[UIView(Hierarchy) _postMovedFromSuperview:] + 298
30 UIKit 0x334aaa4f -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1414
31 UIKit 0x334aa4bf -[UIView(Hierarchy) addSubview:] + 30
32 UIKit 0x3358bdb7 -[UITransitionView transition:fromView:toView:removeFromView:] + 978
33 UIKit 0x335cbf3f -[UITransitionView transition:fromView:toView:] + 30
34 UIKit 0x335cbf15 -[UITransitionView transition:toView:] + 104
35 UIKit 0x335cb03b -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 1106
36 UIKit 0x335cabdf -[UITabBarController transitionFromViewController:toViewController:] + 38
37 UIKit 0x335caab7 -[UITabBarController _setSelectedViewController:] + 258
38 UIKit 0x33694dd5 -[UITabBarController _tabBarItemClicked:] + 272
39 UIKit 0x334d4037 -[UIApplication sendAction:to:from:forEvent:] + 90
40 UIKit 0x334d3fd7 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
41 UIKit 0x33694c8b -[UITabBar _sendAction:withEvent:] + 370
42 UIKit 0x334d4037 -[UIApplication sendAction:to:from:forEvent:] + 90
43 UIKit 0x334d3fd7 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
44 UIKit 0x334d3fb1 -[UIControl sendAction:to:forEvent:] + 44
45 UIKit 0x334bf717 -[UIControl _sendActionsForEvents:withEvent:] + 374
46 UIKit 0x336949ab -[UITabBar(Static) _buttonUp:] + 118
47 UIKit 0x334d4037 -[UIApplication sendAction:to:from:forEvent:] + 90
48 UIKit 0x334d3fd7 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 30
49 UIKit 0x334d3fb1 -[UIControl sendAction:to:forEvent:] + 44
50 UIKit 0x334bf717 -[UIControl _sendActionsForEvents:withEvent:] + 374
51 UIKit 0x334d3a2f -[UIControl touchesEnded:withEvent:] + 590
52 UIKit 0x334d3701 -[UIWindow _sendTouchesForEvent:] + 528
53 UIKit 0x334ce6cb -[UIWindow sendEvent:] + 758
54 UIKit 0x334a38cd -[UIApplication sendEvent:] + 196
55 UIKit 0x334a1f77 _UIApplicationHandleEventQueue + 7102
56 CoreFoundation 0x30c4d20b __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
57 CoreFoundation 0x30c4c6db __CFRunLoopDoSources0 + 206
58 CoreFoundation 0x30c4aecf __CFRunLoopRun + 622
59 CoreFoundation 0x30bb5ebf CFRunLoopRunSpecific + 522
60 CoreFoundation 0x30bb5ca3 CFRunLoopRunInMode + 106
61 GraphicsServices 0x35abb663 GSEventRunModal + 138
62 UIKit 0x3350214d UIApplicationMain + 1136
最佳答案
我遇到了同样的问题。奇怪的是它只出现在 3.5inch 设备(ip4,ip4S),os7.x。在 ip5 上工作正常。
更新:我们的团队找到了根本原因。这是因为我们在代码中使用了这个动画。
[UIView animateWithDuration:0.4f delay:0 usingSpringWithDamping:0.5f initialSpringVelocity:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
self.transform = CGAffineTransformMakeScale(sx,sy);
} completion:^(BOOL finished) {
self.hidden = !visible;
}];
为了修复错误,我们避免在 iOS <8.0>8.0>
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) {
[UIView animateWithDuration:0.4f delay:0 usingSpringWithDamping:0.5f initialSpringVelocity:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
self.transform = CGAffineTransformMakeScale(sx,sy);
} completion:^(BOOL finished) {
if (finished) {
self.hidden = !visible;
}
}];
} else {
self.transform = CGAffineTransformMakeScale(sx,sy);
self.hidden = !visible;
}
希望对您有所帮助!
关于ios - Foundation -[NSConcreteMapTable 分配 :key:value:isNew:] Crashed: com. apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS at,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29899632/
通过rubykoans.com,我在about_array_assignment.rb中遇到了这两段代码你怎么知道第一个是非并行赋值,第二个是一个变量的并行赋值?在我看来,除了命名差异之外,代码几乎完全相同。4deftest_non_parallel_assignment5names=["John","Smith"]6assert_equal["John","Smith"],names7end45deftest_parallel_assignment_with_one_variable46first_name,=["John","Smith"]47assert_equal'John
我早就知道Ruby中的“常量”(即大写的变量名)不是真正常量。与其他编程语言一样,对对象的引用是唯一存储在变量/常量中的东西。(侧边栏:Ruby确实具有“卡住”引用对象不被修改的功能,据我所知,许多其他语言都没有提供这种功能。)所以这是我的问题:当您将一个值重新分配给常量时,您会收到如下警告:>>FOO='bar'=>"bar">>FOO='baz'(irb):2:warning:alreadyinitializedconstantFOO=>"baz"有没有办法强制Ruby抛出异常而不是打印警告?很难弄清楚为什么有时会发生重新分配。 最佳答案
我有一个.pfx格式的证书,我需要使用ruby提取公共(public)、私有(private)和CA证书。使用shell我可以这样做:#ExtractPublicKey(askforpassword)opensslpkcs12-infile.pfx-outfile_public.pem-clcerts-nokeys#ExtractCertificateAuthorityKey(askforpassword)opensslpkcs12-infile.pfx-outfile_ca.pem-cacerts-nokeys#ExtractPrivateKey(askforpassword)o
假设您在Ruby中执行此操作:ar=[1,2]x,y=ar然后,x==1和y==2。是否有一种方法可以在我自己的类中定义,从而产生相同的效果?例如rb=AllYourCode.newx,y=rb到目前为止,对于这样的赋值,我所能做的就是使x==rb和y=nil。Python有这样一个特性:>>>classFoo:...def__iter__(self):...returniter([1,2])...>>>x,y=Foo()>>>x1>>>y2 最佳答案 是的。定义#to_ary。这将使您的对象被视为要分配的数组。irb>o=Obje
我正在使用Dragonfly在Rails3.1应用程序上处理图像。我正在努力通过url将图像分配给模型。我有一个很好的表格:{:multipart=>true}do|f|%>RemovePicture?Dragonfly的文档指出:Dragonfly提供了一个直接从url分配的访问器:@album.cover_image_url='http://some.url/file.jpg'但是当我在控制台中尝试时:=>#ruby-1.9.2-p290>picture.image_url="http://i.imgur.com/QQiMz.jpg"=>"http://i.imgur.com/QQ
使用Paperclip,我想从这样的URL抓取图像:require'open-uri'user.photo=open(url)问题是我最后得到一个像“open-uri20110915-4852-1o7k5uw”这样的文件名。有什么方法可以更改user.photo上的文件名?作为一个额外的变化,Paperclip将我的文件存储在S3上,所以如果我可以在初始分配中设置我想要的文件名就更好了,这样图像就会上传到正确的S3key。像这样:user.photo=open(url),:filename=>URI.parse(url).path 最佳答案
这是我理想中想要的。用户做:a="hello"输出为Youjustallocated"a"!=>"Hello"顺序无关紧要,只要我能实现该消息即可。 最佳答案 不,没有直接的方法可以做到这一点,因为在执行代码之前,Ruby字节码编译器会丢弃局部变量名。YARV(MRI1.9.2中使用的RubyVM)提供的关于局部变量的唯一指令是getlocal和setlocal,它们都对整数索引进行操作,而不是变量名。以下是1.9.2源代码中insns.def的摘录:/****************************************
在Ruby(或Rails)中,我们可以做到new_params=params.merge({:order=>'asc'})现在new_params是一个带有添加键:order的散列。但是是否有一行可以返回带有已删除key的散列?线路new_params=params.delete(:order)不会工作,因为delete方法返回值,仅此而已。我们必须分3步完成吗?tmp_params=paramstmp_params.delete(:order)returntmp_params有没有更好的方法?因为我想做一个new_params=(params[:order].blank?||para
response是一个散列,可能看起来像以下两种情况之一:response={'demo'=>'nil','test_01'=>'DemoData'}或response={'test'=>'DemoData','demo'=>'nil'}我想做这样的事情:ifresponse.has_key?'test_01'new_response.update(:nps_score=>response['test_01']elsenew_response.update(:nps_score=>response['test']end是否有更“Ruby”的方法来解决这个问题?也许使用||的东西运算符(
我正在尝试手动创建一些参数以传递给RailsController函数,为什么参数散列的键用冒号列出,例如params[:key]而不是params["key"]? 最佳答案 Rails使用ActiveSupport’sHashWithIndifferentAccess对于几乎所有来自其自身的哈希值,例如params。HashWithIndifferentAccess的行为与常规哈希相同,除了通过符号或具有相同“值”的字符串进行键访问会返回相同的哈希值。例如:h=HashWithIndifferentAccess.newh[:foo]