我遇到了一个名为DCIntrospect-ARC的pod问题,它只能在DEBUG模式下工作.它会在运行之前检查是否定义了DEBUG宏.但是,它没有在CocoaPods目标中定义,即使我在Xcode中以调试模式运行,它也无法运行,因为未定义DEBUG宏.
我可以使用podspec定义DEBUG宏
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) DEBUG=1' }
Run Code Online (Sandbox Code Playgroud)
但是这为所有构建配置定义了DEBUG,而不仅仅是DEBUG配置.
为了支持该UIAccessibilityReadingContent协议,我需要我的UITextView来回答有关其行的问题.这些是我需要实现的协议的方法:
accessibilityLineNumberForPoint: < - 提供坐标,返回行号accessibilityContentForLineNumber: < - 返回给定行的文本accessibilityFrameForLineNumber: < - 给定行号,返回其帧accessibilityPageContent< - 整个文本内容.我有.:)我认为NSLayoutManager可以帮助我,但我对它没有经验.我已经想到了一些(我认为),但仍然需要一些帮助.
Apple有一些示例代码(此处)可以获取文本视图中的行数:
NSLayoutManager *layoutManager = [textView layoutManager];
unsigned numberOfLines, index, numberOfGlyphs =
[layoutManager numberOfGlyphs];
NSRange lineRange;
for (numberOfLines = 0, index = 0; index < numberOfGlyphs; numberOfLines++){
(void) [layoutManager lineFragmentRectForGlyphAtIndex:index
effectiveRange:&lineRange];
index = NSMaxRange(lineRange);
}
Run Code Online (Sandbox Code Playgroud)
我用lineRange上面的数字来计算,我可以使用这个方法计算行数NSLayoutManager:
- (NSRect)boundingRectForGlyphRange:(NSRange)glyphRange inTextContainer:(NSTextContainer *)container
Run Code Online (Sandbox Code Playgroud)
鉴于lineRanges我应该能够计算一个点的行号(通过找到lineRange包含字形索引的行号):
- (NSUInteger)glyphIndexForPoint:(CGPoint)point inTextContainer:(NSTextContainer *)container fractionOfDistanceThroughGlyph:(CGFloat *)partialFraction
Run Code Online (Sandbox Code Playgroud)
剩下的是,如果给出行号,我如何得到一行(作为一个NSString)的内容?
我有一个具有多个目标的 Xcode 项目。其中两个目标生成应用程序,每个应用程序都有自己的捆绑 ID,通过 Enterprise 开发人员团队 ID 进行分发,而一个目标则通过 App Store 开发人员团队 ID 进行分发。我正在尝试为这个项目设置 Fastlane Match,但我无法让它处理多个团队。
这是我的内容Matchfile:
git_url("git@github.com:myorg/certificates-repo.git")
git_branch("master")
app_identifier([
"my.app.prod", # <-- Team ID A
"my.app.dev", # <-- Team ID B
"my.app.staging" # <-- Team ID B
])
clone_branch_directly(true)
Run Code Online (Sandbox Code Playgroud)
和我的Appfile:
team_id "Team ID B"
apple_id "my@apple.id"
Run Code Online (Sandbox Code Playgroud)
fastlane match当从命令行运行来初始化 Fastlane Match 时,我收到此错误:
git_url("git@github.com:myorg/certificates-repo.git")
git_branch("master")
app_identifier([
"my.app.prod", # <-- Team ID A
"my.app.dev", # <-- Team ID B
"my.app.staging" # <-- Team ID B
])
clone_branch_directly(true)
Run Code Online (Sandbox Code Playgroud)
这是有道理的,因为它不知道 …