- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在开发“BNR iOS 编程指南”第 5 章中名为 whereami 的应用程序。我让该应用程序正常工作并将其留在手机上,以向妻子和家人展示我正在学习的东西。它虽然表现出常规的崩溃行为。这是发生了什么....
当您第一次打开应用程序并运行它时,它运行良好,如果你回到家然后在几分钟内再次打开它就没问题,如果您将它留在后台,然后在几分钟后(比如 5 分钟或更长时间)重新打开它,它就会崩溃。然后您可以重新打开它,它运行良好,但模式会重复。
我已经用这本书仔细检查了我的所有代码,并查看了勘误表页,但无法弄清楚哪里出了问题。 Xcode 管理器显示了所有崩溃的日志,但我还不知道如何阅读。我开始怀疑,既然这只是一个学习项目应用程序,而不是真正的用途,也许它缺少使其成为多任务/后台/重新打开的东西???正确吗?我在 Lion 上使用 Xcode 4.1,iPhone 4 运行 iOS 4.3.4。如果有人能提供任何帮助,我将不胜感激。
以下是我认为是崩溃日志的相关部分:
Incident Identifier: 352B538C-75BB-4BDF-9C2B-EC9613CE1B44
CrashReporter Key: 5896ed7851b999169919cab30c69940f74ed6b0c
Hardware Model: iPhone3,1
Process: WhereAmI [775]
Path: /var/mobile/Applications/DB57A854-01F8-460F-B8CD-38B8FC50FBAF/WhereAmI.app/WhereAmI
Identifier: WhereAmI
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-07-23 18:47:19.093 -0400
OS Version: iPhone OS 4.3.4 (8K2)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x356d8a1c __pthread_kill + 8
1 libsystem_c.dylib 0x34d543b4 pthread_kill + 52
2 libsystem_c.dylib 0x34d4cbf8 abort + 72
3 libstdc++.6.dylib 0x35434a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x35fdd06c _objc_terminate + 104
5 libstdc++.6.dylib 0x35432e36 __cxxabiv1::__terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x35432e8a std::terminate() + 10
7 libstdc++.6.dylib 0x35432f5a __cxa_throw + 78
8 libobjc.A.dylib 0x35fdbc84 objc_exception_throw + 64
9 CoreFoundation 0x3504d3c6 -[NSException raise] + 2
10 MapKit 0x3389bcb2 -[MKMapView setRegion:animated:] + 318
11 WhereAmI 0x000029cc -[WhereAmIAppDelegate mapView:didUpdateUserLocation:] (WhereAmIAppDelegate.m:52)
12 MapKit 0x338a11b6 -[MKMapView(UserPositioningInternal) resetUserLocation] + 142
13 MapKit 0x338a074e -[MKMapView(UserPositioningInternal) locationManagerDidReset:] + 22
14 CoreFoundation 0x34fbaefc -[NSObject(NSObject) performSelector:withObject:] + 16
15 CoreFoundation 0x34ff82f2 -[NSArray makeObjectsPerformSelector:withObject:] + 394
16 MapKit 0x33893802 -[MKLocationManager _reportLocationStatus:] + 34
17 MapKit 0x338937ce -[MKLocationManager _reportLocationReset] + 14
18 MapKit 0x33894d24 -[MKLocationManager reset] + 88
19 MapKit 0x338770a2 -[MKLocationManager applicationResumed:] + 62
20 Foundation 0x30fa017c _nsnote_callback + 136
21 CoreFoundation 0x3501c208 __CFXNotificationPost_old + 396
22 CoreFoundation 0x34fb6ee4 _CFXNotificationPostNotification + 112
23 Foundation 0x30f9d5cc -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
24 UIKit 0x3640f720 -[UIApplication _handleApplicationResumeEvent:] + 900
25 UIKit 0x362b9e20 -[UIApplication handleEvent:withNewEvent:] + 2724
26 UIKit 0x362b920e -[UIApplication sendEvent:] + 38
27 UIKit 0x362b8c4c _UIApplicationHandleEvent + 5084
28 GraphicsServices 0x35827e70 PurpleEventCallback + 660
29 GraphicsServices 0x35827efa PurpleEventSignalCallback + 10
30 CoreFoundation 0x35024a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
31 CoreFoundation 0x35026758 __CFRunLoopDoSources0 + 376
32 CoreFoundation 0x350274e4 __CFRunLoopRun + 224
33 CoreFoundation 0x34fb7ebc CFRunLoopRunSpecific + 224
34 CoreFoundation 0x34fb7dc4 CFRunLoopRunInMode + 52
35 GraphicsServices 0x35827418 GSEventRunModal + 108
36 GraphicsServices 0x358274c4 GSEventRun + 56
37 UIKit 0x362e3d62 -[UIApplication _run] + 398
38 UIKit 0x362e1800 UIApplicationMain + 664
39 WhereAmI 0x000027c0 main (main.m:14)
40 WhereAmI 0x00002768 start + 32
我对此很陌生,但我猜最后调用的函数在这里:
8 libobjc.A.dylib 0x35fdbc84 objc_exception_throw + 64
9 CoreFoundation 0x3504d3c6 -[NSException raise] + 2
10 MapKit 0x3389bcb2 -[MKMapView setRegion:animated:] + 318
11 WhereAmI 0x000029cc -[WhereAmIAppDelegate mapView:didUpdateUserLocation:] (WhereAmIAppDelegate.m:52)
WhereAmIAppDelegate.m 的方法代码在这里:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{
// Zoom in on user here
CLLocationCoordinate2D loc = [userLocation coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
[worldView setRegion:region animated:YES];
}
最佳答案
我在本书的第 3 版中遇到了这个问题,并在本书的第 2 版论坛中看到了该问题的解答,但此处没有。问题是,当应用程序从后台运行超过 5-10 分钟后返回时,WhereAmIAppDelegate 收到无效位置。不知道为什么会这样,但这是我修复它的方法:
- (void)mapView:(MKMapView *)mapView
didUpdateUserLocation:(MKUserLocation *)userLocation
{
// Here we are... but how do we actually zoom?
CLLocationCoordinate2D loc = [userLocation coordinate];
if(CLLocationCoordinate2DIsValid(loc))
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 320, 480);
[worldView setRegion:region animated:YES];
}
}
很抱歉“破坏”了一个旧线程,但我认为这可能会对寻求帮助的人有所帮助。顺便说一下,我使用的是 Xcode 4.3.2 和 iOS 5.1。
关于ios - 我正在学习 iOS 开发并且有一个崩溃的 MapKit 应用程序。需要帮助理解这个崩溃日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6811085/
我需要一些说明。我可以直接写入 /dev/port 以直接访问并行端口并且它工作正常(我可以打开插入端口连接器的 LED)。但是,我想我可以用 /dev/mem 做同样的事情? (http://tld
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我使用 Visual C++ 和 Win32 API 学习了 Windows 编程。如今,似乎大多数应用程序都是使用 C# 在 .NET 中开发的。我知道大多数时候 native 代码和托管代码之间没
请耐心等待。我正在制作一个 java 控制台,类似于此处找到的 DragonConsole https://code.google.com/p/dragonconsole/ 。一切都按计划进行,但我想
关闭。这个问题需要更多 focused .它目前不接受答案。 想要改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭5年前。 Improve this que
Django 的开发服务器表现得很奇怪。访问它的浏览器在加载时卡住,任何退出它的尝试都不起作用。当我点击 control c看似相当,但实际上仍在运行。让它退出的唯一方法是重新启动我的电脑,这很令人沮
我正在使用 Flash Develop,并且创建了一个 ActionScript 3.0 项目。它启动并读取一个 xml 文件,其中包含图像的 url。我已将 url 保留在与 swf 相同的文件夹中
是否可以根据其 website 上提供的规范开发 AUTOSAR BSW 堆栈(例如用于 CAN 通信)?不购买任何昂贵的供应商工具?可以遵循哪些步骤?我被要求探索这种可能性。 最佳答案 是和否。工具
有人知道如何用音频文件的内容覆盖 iPhone 麦克风吗? 想象一个场景,您正在通话,并且想要播放一些简短的音频让其他人听到。 因此,有必要将麦克风(硬件)置于保持状态,并使用委托(delegate)
我遇到了这个问题,我的应用程序出现 EXC_BAD_ACCESS 错误并卡住/停止。我使用模拟器的“向左旋转”和“向右旋转”选项来模拟方向变化行为。导致此错误的可能原因有哪些?由于我没有获得有关错误的
我有超过 1 台 Mac,我想在所有这些 Mac 上进行开发。我知道我需要在每台机器上同步我的手机,但这是我遇到的最小的问题。看起来我无法在手机上运行应用程序,除了在其中之一上开发的应用程序。 是否有
在手机上测试时,我的应用程序在特定点崩溃。控制台显示此消息 Tue Jan 27 15:47:14 unknown SpringBoard[22] : Application com.myprof.
我有一个案例,我从服务器获取信息。我的应用程序有一个选项卡栏和导航按钮。我希望应用程序显示进度指示器并禁用所有其他控件,以便用户在从服务器提取数据时无法跳转。我怎样才能实现这个目标? 我想到的一种方法
有时,当我尝试“构建”/编译下载的源代码时,我会收到以下警告: ld: warning: directory '/Volumes/Skiiing2/CD/ViewBased/Unknown Path/
我无法在 Apple 文档中找到关于开发和分发配置之间差异的明确解释。我目前正在使用开发配置在我的 iPhone 上进行开发和测试。我打算将该应用程序分发到我的 Beta 测试中,我想知道: 我需要使
我在使用 SharePoint 时遇到的最大挑战之一是它不能很好地适应典型的项目环境,其中至少包含开发和生产环境。我遇到的最多的问题是内容和列表是如此紧密地耦合在一起,以至于如果不在生产环境中执行内容
我失败了fist step让 Eclipse(对我来说是全新的)为 ARM 开发做好准备。 我在 Windows 10 中安装了 Eclipse。我想我应该安装 xpm,但我不知道在哪里输入此命令:
首先,我告诉你-我是编码新手 我正在使用vs代码来学习c++,它不会产生像dev c++或codeblocks这样的调试器。我看了一些视频,其中我们必须编辑json文件,这对于初学者来说非常复杂。有人
我失败了fist step让 Eclipse(对我来说是全新的)为 ARM 开发做好准备。 我在 Windows 10 中安装了 Eclipse。我想我应该安装 xpm,但我不知道在哪里输入此命令:
我开发了一个 Ionic 应用程序(iOS 和 Android 的混合)。我有 Xcode 8.3.3 并购买了一年的 Apple Developer Program 订阅。 我不想测试我的应用并将其
我是一名优秀的程序员,十分优秀!