草庐IT

ios - 在模拟器上启动应用程序会导致 Xcode 崩溃

coder 2024-01-10 原文

我在 OSx Mavericks 上的 Xcode 5.0.2 中创建了一个空的 iOS 项目。当我单击 Play 按钮 以在 iPhone 模拟器上启动应用程序时,Xcode 崩溃。我也禁用了 Xcode 的源代码控制功能,但当我单击播放按钮时它仍然崩溃。这是崩溃日志。

Process:         Xcode [1484]
Path:            /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:      com.apple.dt.Xcode
Version:         5.0.2 (3335.32)
Build Info:      IDEApplication-3335032000000000~4
Code Type:       X86-64 (Native)
Parent Process:  launchd [138]
Responsible:     Xcode [1484]
User ID:         501

Date/Time:       2014-04-13 09:13:37.899 -0700
OS Version:      Mac OS X 10.9 (13A476u)
Report Version:  11
Anonymous UUID:  7C2BACB3-50DC-AAE3-93F3-1C62CA3A1868


Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
Sending performRunAction: to <IDERunPauseContinueToolbarButton: 0x7fe12d932b50> from <IDERunPauseContinueToolbarButton: 0x7fe12d932b50>
ProductBuildVersion: 5A3005
UNCAUGHT EXCEPTION (NSInvalidArgumentException): must provide a file handle or pipe
UserInfo: (null)
Hints: 
  0: Sending performRunAction: to <IDERunPauseContinueToolbarButton: 0x7fe12d932b50> from <IDERunPauseContinueToolbarButton: 0x7fe12d932b50>
  1: Sending performAction: to <DVTDelayedMenuButtonCell: 0x7fe12d933180> from <IDERunPauseContinueToolbarButton: 0x7fe12d932b50>
Backtrace:
  0  0x00007fff90c858b6 __exceptionPreprocess (in CoreFoundation)
  1  0x000000010fd86d73 DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2  0x00007fff85ef3f51 objc_exception_throw (in libobjc.A.dylib)
  3  0x00007fff90c856bc +[NSException raise:format:] (in CoreFoundation)
  4  0x00007fff90412dce NOCOPY_SETTER_IMPL (in Foundation)
  5  0x0000000112528c6b __48-[DVTDeveloperModeHelper isDeveloperModeEnabled]_block_invoke (in DVTDeveloperModeHelper)
  6  0x0000000112528ba6 -[DVTDeveloperModeHelper isDeveloperModeEnabled] (in DVTDeveloperModeHelper)
  7  0x0000000112529160 __63-[DVTDeveloperModeAlertHelper _shouldAskUserAboutDeveloperMode]_block_invoke (in DVTDeveloperModeHelper)
  8  0x00007fff8eaebc74 _dispatch_client_callout (in libdispatch.dylib)
  9  0x00007fff8eaebbe2 dispatch_once_f (in libdispatch.dylib)
 10  0x0000000112529108 -[DVTDeveloperModeAlertHelper _shouldAskUserAboutDeveloperMode] (in DVTDeveloperModeHelper)
 11  0x00000001125291c0 -[DVTDeveloperModeAlertHelper _askToEnableDeveloperModeIfNecessary] (in DVTDeveloperModeHelper)
 12  0x0000000110fbf657 -[IDEWorkspaceTabController _performDebuggableSchemeTask:onScheme:runDestination:command:commandName:buildCommand:filePath:overridingTestingSpecifiers:invocationRecord:completionBlock:] (in IDEKit)
 13  0x0000000110fc02a8 -[IDEWorkspaceTabController _runScheme:runDestination:invocationRecord:] (in IDEKit)
 14  0x0000000110f0673b -[IDEWorkspaceTabController runActiveRunContext:] (in IDEKit)
 15  0x00000001110191b1 -[IDERunPauseContinueToolbarButton performRunAction:] (in IDEKit)
 16  0x00007fff8b0410da -[NSApplication sendAction:to:from:] (in AppKit)
 17  0x0000000110467aff __37-[DVTApplication sendAction:to:from:]_block_invoke (in DVTKit)
 18  0x000000010fd86ab1 DVTInvokeWithFailureHint (in DVTFoundation)
 19  0x00000001102995ba -[DVTApplication sendAction:to:from:] (in DVTKit)
 20  0x000000011045c220 -[DVTDelayedMenuButtonCell performAction:] (in DVTKit)
 21  0x00007fff8b0410da -[NSApplication sendAction:to:from:] (in AppKit)
 22  0x0000000110467aff __37-[DVTApplication sendAction:to:from:]_block_invoke (in DVTKit)
 23  0x000000010fd86ab1 DVTInvokeWithFailureHint (in DVTFoundation)
 24  0x00000001102995ba -[DVTApplication sendAction:to:from:] (in DVTKit)
 25  0x0000000110364a74 -[DVTDelayedMenuButtonCell trackMouse:inRect:ofView:untilMouseUp:] (in DVTKit)
 26  0x00007fff8b03e4d6 -[NSControl mouseDown:] (in AppKit)
 27  0x0000000110380832 -[DVTMainStatusAwareButton mouseDown:] (in DVTKit)
 28  0x00000001103807c3 -[DVTRolloverTrackingButton mouseDown:] (in DVTKit)
 29  0x00007fff8b037918 -[NSWindow sendEvent:] (in AppKit)
 30  0x00007fff8b031f48 -[NSApplication sendEvent:] (in AppKit)
 31  0x0000000110e0083b -[IDEApplication sendEvent:] (in IDEKit)
 32  0x00007fff8af53599 -[NSApplication run] (in AppKit)
 33  0x00007fff8aefd563 NSApplicationMain (in AppKit)
 34  0x00007fff882ea60d start (in libdyld.dylib)

Performing @selector(performRunAction:) from sender IDERunPauseContinueToolbarButton 0x7fe12d932b50
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff86cbf8a6 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff8f5e53c5 pthread_kill + 92
2   libsystem_c.dylib               0x00007fff8c54fb7e abort + 125
3   com.apple.dt.IDEKit             0x0000000110ffd7af +[IDEAssertionHandler _handleAssertionWithLogString:reason:] + 775
4   com.apple.dt.IDEKit             0x0000000110ffe9fd -[IDEAssertionHandler handleUncaughtException:] + 919
5   com.apple.dt.IDEKit             0x0000000110ffeaa8 IDEHandleUncaughtException + 77
6   com.apple.CoreFoundation        0x00007fff90d2ba82 __handleUncaughtException + 706
7   libobjc.A.dylib                 0x00007fff85ef43e0 _objc_terminate() + 94
8   libc++abi.dylib                 0x00007fff89eccebf std::__terminate(void (*)()) + 6
9   libc++abi.dylib                 0x00007fff89eccf36 std::terminate() + 54
10  libobjc.A.dylib                 0x00007fff85ef418c objc_terminate + 9
11  libdispatch.dylib               0x00007fff8eaebc88 _dispatch_client_callout + 28
12  libdispatch.dylib               0x00007fff8eaebbe2 dispatch_once_f + 79
13  com.apple.dt.DVTDeveloperModeHelper 0x0000000112529108 -[DVTDeveloperModeAlertHelper _shouldAskUserAboutDeveloperMode] + 103
14  com.apple.dt.DVTDeveloperModeHelper 0x00000001125291c0 -[DVTDeveloperModeAlertHelper _askToEnableDeveloperModeIfNecessary] + 29
15  com.apple.dt.IDEKit             0x0000000110fbf657 -[IDEWorkspaceTabController _performDebuggableSchemeTask:onScheme:runDestination:command:commandName:buildCommand:filePath:overridingTestingSpecifiers:invocationRecord:completionBlock:] + 1074
16  com.apple.dt.IDEKit             0x0000000110fc02a8 -[IDEWorkspaceTabController _runScheme:runDestination:invocationRecord:] + 275
17  com.apple.dt.IDEKit             0x0000000110f0673b -[IDEWorkspaceTabController runActiveRunContext:] + 188
18  com.apple.dt.IDEKit             0x00000001110191b1 -[IDERunPauseContinueToolbarButton performRunAction:] + 500
19  com.apple.AppKit                0x00007fff8b0410da -[NSApplication sendAction:to:from:] + 327
20  com.apple.dt.DVTKit             0x0000000110467aff __37-[DVTApplication sendAction:to:from:]_block_invoke + 351
21  com.apple.dt.DVTFoundation      0x000000010fd86ab1 DVTInvokeWithFailureHint + 82
22  com.apple.dt.DVTKit             0x00000001102995ba -[DVTApplication sendAction:to:from:] + 344
23  com.apple.dt.DVTKit             0x000000011045c220 -[DVTDelayedMenuButtonCell performAction:] + 198
24  com.apple.AppKit                0x00007fff8b0410da -[NSApplication sendAction:to:from:] + 327
25  com.apple.dt.DVTKit             0x0000000110467aff __37-[DVTApplication sendAction:to:from:]_block_invoke + 351
26  com.apple.dt.DVTFoundation      0x000000010fd86ab1 DVTInvokeWithFailureHint + 82
27  com.apple.dt.DVTKit             0x00000001102995ba -[DVTApplication sendAction:to:from:] + 344
28  com.apple.dt.DVTKit             0x0000000110364a74 -[DVTDelayedMenuButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 693
29  com.apple.AppKit                0x00007fff8b03e4d6 -[NSControl mouseDown:] + 706
30  com.apple.dt.DVTKit             0x0000000110380832 -[DVTMainStatusAwareButton mouseDown:] + 97
31  com.apple.dt.DVTKit             0x00000001103807c3 -[DVTRolloverTrackingButton mouseDown:] + 57
32  com.apple.AppKit                0x00007fff8b037918 -[NSWindow sendEvent:] + 11303
33  com.apple.AppKit                0x00007fff8b031f48 -[NSApplication sendEvent:] + 2021
34  com.apple.dt.IDEKit             0x0000000110e0083b -[IDEApplication sendEvent:] + 444
35  com.apple.AppKit                0x00007fff8af53599 -[NSApplication run] + 646
36  com.apple.AppKit                0x00007fff8aefd563 NSApplicationMain + 940
37  libdyld.dylib                   0x00007fff882ea60d start + 1

Thread 1:
0   libsystem_kernel.dylib          0x00007fff86cbfeaa __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8f5e5f4e _pthread_wqthread + 324
2   libsystem_pthread.dylib         0x00007fff8f5e8fd9 start_wqthread + 13

Thread 2:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff86cc06a2 kevent64 + 10
1   libdispatch.dylib               0x00007fff8eaedda6 _dispatch_mgr_invoke + 227
2   libdispatch.dylib               0x00007fff8eaedcb2 _dispatch_mgr_thread + 52

Thread 3:: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0x00007fff86cbba76 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff86cbad74 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff90c20ee5 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff90c27179 __CFRunLoopRun + 1497
4   com.apple.CoreFoundation        0x00007fff90c267b3 CFRunLoopRunSpecific + 467
5   com.apple.Foundation            0x00007fff902b2a47 +[NSURLConnection(Loader) _resourceLoadLoop:] + 348
6   com.apple.Foundation            0x00007fff9030cc73 __NSThread__main__ + 1319
7   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
8   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
9   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 4:: com.apple.CFSocket.private
0   libsystem_kernel.dylib          0x00007fff86cbf9ea __select + 10
1   com.apple.CoreFoundation        0x00007fff90c66a53 __CFSocketManager + 867
2   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
3   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
4   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff86cbba76 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff86cbad74 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff90c20ee5 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff90c27179 __CFRunLoopRun + 1497
4   com.apple.CoreFoundation        0x00007fff90c267b3 CFRunLoopRunSpecific + 467
5   com.apple.DTDeviceKitBase       0x000000011a65e81a -[DTDKRemoteDeviceDataListener listenerThreadImplementation] + 164
6   com.apple.Foundation            0x00007fff9030cc73 __NSThread__main__ + 1319
7   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
8   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
9   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 6:: DYMobileDeviceManager
0   libsystem_kernel.dylib          0x00007fff86cbba76 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff86cbad74 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff90c20ee5 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff90c27179 __CFRunLoopRun + 1497
4   com.apple.CoreFoundation        0x00007fff90c267b3 CFRunLoopRunSpecific + 467
5   com.apple.Foundation            0x00007fff903122fc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 253
6   com.apple.Foundation            0x00007fff902af10a -[NSRunLoop(NSRunLoop) run] + 74
7   com.apple.GPUToolsMobileFoundation  0x000000011b2eb96b -[DYMobileDeviceManager _deviceNotificationThread:] + 132
8   com.apple.Foundation            0x00007fff9030cc73 __NSThread__main__ + 1319
9   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
10  libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
11  libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 7:: CVDisplayLink
0   libsystem_kernel.dylib          0x00007fff86cbf756 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff8f5e6c7b _pthread_cond_wait + 727
2   com.apple.CoreVideo             0x00007fff90deca8c CVDisplayLink::runIOThread() + 656
3   com.apple.CoreVideo             0x00007fff90dec7e3 startIOThread(void*) + 147
4   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
5   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
6   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 8:
0   libsystem_kernel.dylib          0x00007fff86cbba76 mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff86cbad74 mach_msg + 64
2   com.apple.CoreFoundation        0x00007fff90c20ee5 __CFRunLoopServiceMachPort + 181
3   com.apple.CoreFoundation        0x00007fff90c27179 __CFRunLoopRun + 1497
4   com.apple.CoreFoundation        0x00007fff90c267b3 CFRunLoopRunSpecific + 467
5   com.apple.AppKit                0x00007fff8b2c97f8 _NSEventThread + 144
6   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
7   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
8   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 9:
0   libsystem_kernel.dylib          0x00007fff86cbfeaa __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fff8f5e5f4e _pthread_wqthread + 324
2   libsystem_pthread.dylib         0x00007fff8f5e8fd9 start_wqthread + 13

Thread 10:
0   libsystem_kernel.dylib          0x00007fff86cbfa7a __semwait_signal + 10
1   libsystem_c.dylib               0x00007fff8c56ee24 nanosleep + 200
2   com.apple.CoreSymbolication     0x00007fff92006841 0x7fff91ff3000 + 79937
3   libsystem_pthread.dylib         0x00007fff8f5e490f _pthread_body + 138
4   libsystem_pthread.dylib         0x00007fff8f5e47a0 _pthread_start + 131
5   libsystem_pthread.dylib         0x00007fff8f5e8fe9 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00007fff77d89310  rcx: 0x00007fff4ff20a28  rdx: 0x0000000000000000
  rdi: 0x0000000000000707  rsi: 0x0000000000000006  rbp: 0x00007fff4ff20a50  rsp: 0x00007fff4ff20a28
   r8: 0x00007fe12a80b200   r9: 0x0000000000000081  r10: 0x0000000008000000  r11: 0x0000000000000206
  r12: 0x00007fff4ff20b68  r13: 0x00000001116cf4e8  r14: 0x0000000000000006  r15: 0x00007fe12dd27670
  rip: 0x00007fff86cbf8a6  rfl: 0x0000000000000206  cr2: 0x000000011507e000

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133


Binary Images:
       0x10fcde000 -        0x10fcdeff7  com.apple.dt.Xcode (5.0.2 - 3335.32) <325477C5-32DB-3091-91B7-41B670C5C0ED> /Applications/Xcode.app/Contents/MacOS/Xcode
/System/Library/PrivateFrameworks/DiskManagement.framework/Versions/A/DiskManagement

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 14
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 227454
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=350.7M resident=79.7M(23%) swapped_out_or_unallocated=271.0M(77%)
Writable regions: Total=1.2G written=40.0M(3%) resident=74.4M(6%) swapped_out=0K(0%) unallocated=1.1G(94%)

REGION TYPE                        VIRTUAL
===========                        =======
CG backing stores                    3812K
CG image                              824K
CG raster data                        292K
CG shared images                      212K
CoreAnimation                         480K
CoreData                                4K
CoreData Object IDs                  4100K
CoreImage                              72K
CoreServices                          592K
Dispatch continuations               16.0M
IOKit                                 404K
Image IO                              360K
JS JIT generated code                   8K
JS JIT generated code (reserved)      1.0G        reserved VM address space (unallocated)
Kernel Alloc Once                       8K
MALLOC                              126.3M
MALLOC (admin)                         32K
Memory Tag 242                         12K
Memory Tag 249                        156K
Memory Tag 251                         16K
OpenCL                                 68K
SQLite page cache                    1632K
STACK GUARD                          56.0M
Stack                                12.2M
VM_ALLOCATE                          16.5M
WebKit Malloc                        1272K
__DATA                               46.2M
__IMAGE                               528K
__LINKEDIT                           87.8M
__TEXT                              263.1M
__UNICODE                             544K
mapped file                         165.9M
shared memory                           4K
===========                        =======
TOTAL                                 1.8G
TOTAL, minus reserved VM space      805.3M

这个问题的解决方案是什么?

问候

最佳答案

尝试一个新的。如果它仍然崩溃,则编辑方案并将调试器从 LLDB 更改为 GDB(反之亦然)。在构建您的应用程序之前,不要忘记“清理您的项目”(shift + command + k) 和“iOS Simulator”(Reset Content and setting) 希望它能解决您的问题问题。

关于ios - 在模拟器上启动应用程序会导致 Xcode 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23045137/

有关ios - 在模拟器上启动应用程序会导致 Xcode 崩溃的更多相关文章

  1. ruby - 将差异补丁应用于字符串/文件 - 2

    对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl

  2. ruby-on-rails - Rails 应用程序之间的通信 - 2

    我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此

  3. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  4. ruby-on-rails - Rails 应用程序中的 Rails : How are you using application_controller. rb 是新手吗? - 2

    刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr

  5. ruby - 如何模拟 Net::HTTP::Post? - 2

    是的,我知道最好使用webmock,但我想知道如何在RSpec中模拟此方法:defmethod_to_testurl=URI.parseurireq=Net::HTTP::Post.newurl.pathres=Net::HTTP.start(url.host,url.port)do|http|http.requestreq,foo:1endresend这是RSpec:let(:uri){'http://example.com'}specify'HTTPcall'dohttp=mock:httpNet::HTTP.stub!(:start).and_yieldhttphttp.shou

  6. ruby - 如何在 Lion 上安装 Xcode 4.6,需要用 RVM 升级 ruby - 2

    我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121

  7. ruby-on-rails - 启动 Rails 服务器时 ImageMagick 的警告 - 2

    最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru

  8. ruby-on-rails - 如何在我的 Rails 应用程序 View 中打印 ruby​​ 变量的内容? - 2

    我是一个Rails初学者,但我想从我的RailsView(html.haml文件)中查看Ruby变量的内容。我试图在ruby​​中打印出变量(认为它会在终端中出现),但没有得到任何结果。有什么建议吗?我知道Rails调试器,但更喜欢使用inspect来打印我的变量。 最佳答案 您可以在View中使用puts方法将信息输出到服务器控制台。您应该能够在View中的任何位置使用Haml执行以下操作:-puts@my_variable.inspect 关于ruby-on-rails-如何在我的R

  9. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  10. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

随机推荐