我正在尝试通过一些时髦的UIView行为进行调试,并且我一直在遇到LLDB绝对无用和误导的情况.让我告诉你我的意思:
NSLog(@"myView: %@", myView);
2012-04-20 15:24:57.070 myProj[35789:f803] myView: <MyView: 0x7cc7500; frame = (0 119; 768 885); layer = <CALayer: 0x7cc8030>>
Run Code Online (Sandbox Code Playgroud)
但是当我在那个确切时刻设置断点并尝试使用调试器时,它返回nil:
(lldb) po myView
(MyView *) $552 = 0x00000000 <nil>
Run Code Online (Sandbox Code Playgroud)
我会尝试转移到GCC 4.2以查看它是否有帮助,但在LLVM GCC 4.2下编译不是一个选项,因为这是一个ARC项目.
当然,如果我已经知道要查询的正确地址,LLDB将会起作用.但是,对于某些对象,符号名称和地址之间的链接似乎已被破坏,尽管它适用于大多数其他对象.
(lldb) po self
(MyViewController *const) $51 = 0x07e92200 <MyViewController: 0x7e92200>
(lldb) po myView
(MyView *) $25 = 0x00000000 <nil>
2012-04-20 15:44:17.250 myProject[37551:f803] myView: <MyView: 0x7e8e240; frame = (0 119; 768 885); layer = <CALayer: 0x7ea2330>>
(lldb) po 0x7e8e240
(int) $50 = 132702784 <MyView: 0x7e8e240; frame …Run Code Online (Sandbox Code Playgroud) 我想将NSString从一个类传递到另一个类,并将NSString添加到我的第二个类中的NSMutableArray.我相信我可以使用NSNotification,但我不知道如何通过变量通知.我的代码是这样的:
//class1.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property(strong,nonatomic)NSString *variableString;
@end
Run Code Online (Sandbox Code Playgroud)
//class1.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize variableString = _variableString;
- (void)viewDidLoad
{
[super viewDidLoad];
[self setVariableString:@"test"];
[[NSNotificationCenter defaultCenter] postNotificationName: @"pasteString" object: _variableString];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
@end
Run Code Online (Sandbox Code Playgroud)
//class2.h
#import <UIKit/UIKit.h>
@interface ViewController2 : UIViewController
@property(strong,nonatomic)NSMutableArray *arr;
@end
Run Code Online (Sandbox Code Playgroud)
//class2.m
#import "ViewController2.h" …Run Code Online (Sandbox Code Playgroud) 我在我的方案中添加了自定义脚本作为构建阶段的预操作(在构建实际开始之前我需要执行一些更改(包括 Info.plist 操作) - 因此我无法使用构建阶段脚本,因为它们在 Info.plist 之后运行)被复制到产品中)。一切工作正常,除了当我清理项目时该脚本也会执行这一事实。我不需要它。
我检查了在不同情况下传递给脚本的环境和可能的参数,但它们在构建和清理场景中是相同的。
有什么方法可以在清理期间禁用脚本执行吗?或者也许可以在脚本中以某种方式检查它是否在清理或构建期间启动。
我正在使用 Xcode 5。
先感谢您。
我试图向某人演示基本继承以及在覆盖 init 时默认情况下如何始终调用超级初始化程序:
class Animal{
init(){
println("Animal has been initialized!")
}
}
class Dog:Animal{
var feet:Int = 4
override init(){
println("Dog has been initialized!")
}
}
var d = Dog()
Run Code Online (Sandbox Code Playgroud)
为什么我会排{__lldb_expr_380.Animal feet 4}在最后一行?当我在动物类下创建实例变量时,它就会消失。
我的本机应用程序之前在 xcode 11 中构建并在模拟器上运行。但是,自从升级到 xcode 12.5 后,我收到以下构建错误
Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class>*'
Cannot initialize a parameter of type 'NSArray<Class> *' with an lvalue of type 'NSArray<id<RCTBridgeModule>> *__strong'
Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong'
Run Code Online (Sandbox Code Playgroud)
这些错误来自我的项目中通过 cocoapods 的 react-core。
自从升级到 Xcode 12.5 以来,我从 SPM 收到了这个警告(我认为),我有两个问题:
将不胜感激任何回应。我在谷歌上找不到这些问题的好的答案。
当我在我的应用程序中快速移动时发生崩溃(打开一个子页面然后返回登陆)。
来自 TestFlight 的应用程序崩溃日志:
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001c87ff334 __pthread_kill + 8
1 libsystem_pthread.dylib 0x00000001e6221aa0 pthread_kill + 272 (pthread.c:1392)
2 libsystem_c.dylib 0x00000001a3b86c10 __abort + 116 (abort.c:147)
3 libsystem_c.dylib 0x00000001a3b86b9c abort + 116 (abort.c:118)
4 AttributeGraph 0x00000001c3c31a6c AG::precondition_failure(char const*, ...) + 192 (ag-util.cc:51)
5 AttributeGraph 0x00000001c3c1f4cc AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 828 (ag-graph.cc:0)
6 AttributeGraph 0x00000001c3c3109c AGGraphGetValue + 232 (ag-graph-impl.h:43)
7 SwiftUI 0x00000001a140bbc4 AnyViewList.Item.list.getter + 72 (<compiler-generated>:0)
8 SwiftUI 0x00000001a140b5e8 AnyViewList.updateValue() + 512 …Run Code Online (Sandbox Code Playgroud) 在 Xcode 13 beta 中运行模拟器,我遇到了崩溃?我该怎么办?
_validateTextureView:557: failed assertion `Texture View Validation
cannot create View from Memoryless texture.
texture usage (0x04) doesn't specify MTLTextureUsagePixelFormatView (0x10)
'
dyld4 config: DYLD_ROOT_PATH=/Users/****/Desktop/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/****/Library/Developer/Xcode/DerivedData/Truckloads-cpaazflnngvcgdegppomicvsczis/Build/Products/Debug-iphonesimulator:/Users/****/Desktop/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Users/****/Desktop/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Users/****/Desktop/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Users/****/Desktop/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/****/Library/Developer/Xcode/DerivedData/Truckloads-cpaazflnngvcgdegppomicvsczis/Build/Products/Debug-iphonesimulator
_validateTextureView:557: failed assertion `Texture View Validation
cannot create View from Memoryless texture.
texture usage (0x04) doesn't specify MTLTextureUsagePixelFormatView (0x10)
'
CoreSimulator 772.1 - Device: iPhone 12 Pro Max (84610676-549B-47F6-A87E-D0B4877032ED) - Runtime: iOS 15.0 (19A5261u) - DeviceType: iPhone 12 Pro Max
(lldb)
Run Code Online (Sandbox Code Playgroud) 刚刚下载了最新的 Xcode 13 beta 3,但我无法预览工作:
PlatformDoesNotHaveAgentsError:缺少 iOS 所需的组件
Xcode 缺少在 iOS 上预览所需的组件
==================================
| HumanReadableSwiftError | | 位置错误:noBundle
重新启动没有帮助。
在 MBP Intel、macOS 11.4 上测试
不知道是我mac的问题还是这个版本引入的bug。
任何线索?
编辑:看起来只有在您选择 iOS 15 模拟器时才有效,您不能再使用 iOS 14.x 版本...
更新:
VNC 进入构建机器(不做任何更改)以某种方式修复了这个......奇怪
语境
我们使用 Mac EC2 实例 CI 集群来运行 UI 测试。集群设置为每晚回收。这意味着新集群是在早上配置的。我们注意到测试在一天中变得越来越不稳定。
日志
片状测试或失败通常是由于“等待某些资源空闲”并达到超时,或某些网络请求完成。失败或不稳定的测试也有一个共同点,即它们通常与视频有关
这是几个示例日志
等待应用空闲
Timed out waiting for app to idle.
The following idling resources are busy.
1. GREYAppStateTracker:
Waiting for network requests to finish. By default, EarlGrey tracks all network requests. To change this behavior, refer to GREYConfiguration.
<__NSCFLocalDataTask:0x7fcfcfd87450, URL:"https://v.myorgimg.com/videos/mc/hls/e7/01/ca/e701caebac12684056eb699f316fc411_360w.m3u8"> => Waiting for network requests to finish. By default, EarlGrey tracks all network requests. To change this behavior, refer to …Run Code Online (Sandbox Code Playgroud)