我正在开发一个使用的项目UISlideViewController.我知道这可能是一个重复的问题,但关于这个主题之前的帖子没有帮助我.我有一个特定的问题,因为我设法理解.我的应用程序崩溃了.我之前已经阅读过,将所有工作与UI放在主线程中非常重要.这是代码:
pageViewController.setViewControllers([viewController],
direction: direction,
animated: animated,
completion: { completed in
dispatch_async(dispatch_get_main_queue()) {
...
Run Code Online (Sandbox Code Playgroud)
我得到的错误是下一个:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Duplicate states in queue'
*** First throw call stack:
(0x183fd1900 0x18363ff80 0x183fd17d0 0x18494499c 0x1894dc9f4 0x1894dcdec...)
Run Code Online (Sandbox Code Playgroud)
进一步测试我也在同一行代码上得到这个错误:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No view controller managing visible view <UITableView: 0x12744aa00;
frame = (0 0; 375 515);
clipsToBounds = YES; autoresize = W+H;
gestureRecognizers = <NSArray: 0x12836cf60>;
layer = <CALayer: 0x1286226b0>;
contentOffset: {0, …Run Code Online (Sandbox Code Playgroud) 我正在开发一个使用 Firebase 进行分析、crashlytics 和远程配置获取的 iOS 项目。对于依赖项管理,我使用 cocoapods 并且项目中当前版本的 Firebase 是最新的 - 6.22.0.
这里的问题是应用程序在配置 Firebase (ObjC -> [FIRApp configure];)的代码行上的每次新启动时崩溃。我已经看到了一些类似的帖子,但没有一个对我的情况有帮助,除非我遗漏了一些东西。
部分项目结构如下图所示。红色表示主要xcodeproj目标和应用程序的主文件。蓝色表示xcodeproj自定义框架的文件,其中包含帮助FirebaseAnalytics程序,包括用于分析日志记录的包装器,这意味着它具有其依赖性pod Firebase/Analytics。此自定义框架用于标有红色的主应用程序目标。(在pod install我总是打开之后xcworkspace,所以这是在xcworkspace)。
以下是Podfile.
target 'TheApp' do
platform :ios, '11.0'
project 'TheApp/TheApp.xcodeproj'
use_frameworks!
pod 'Firebase/Auth'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
end
target 'TheCustomFramework' do
platform :ios, '11.0'
project 'TheCustomFramework/TheCustomFramework.xcodeproj'
use_frameworks!
pod 'Firebase/Analytics'
end
Run Code Online (Sandbox Code Playgroud)
我在应用程序委托中添加了 Firebase 配置方法,如谷歌文档中所示。
另外,我已经GoogleService-Info.plist按照谷歌文档的说明在项目中添加了文件。
但是该应用程序不断在didFinishLaunchingWithOptions方法 in …
我正在使用UITableViewin Swift,我有一个函数,它根据某些条件返回行数,另一个函数返回每个节的标题.两个函数具有相同的主体,相同的条件,但第一个函数返回Intdat类型,第二个函数返回String数据类型.
我可以以某种方式使这个泛型函数成为一个返回一些通用值的函数,但该值必须是'Int'用于第一个函数和String第二个函数.
下面的代码是返回行数的函数.相同的主体去返回部分标题的功能.它的返回类型是String.
func getNumberOfRows(for section: Int) -> Int {
let parameters = SuggestionsTableSectionType.Parameters(recents: recents, suggestions: suggestions, section: section)
if SuggestionsTableSectionType.recentsAndSectionIsZero(parameters).isActive {
return recents.count
} else if SuggestionsTableSectionType.suggestionsAndSectionIsZero(parameters).isActive {
return suggestions.count
} else if SuggestionsTableSectionType.recentsAndSuggestionsAndSectionIsZero(parameters).isActive {
return recents.count
} else if SuggestionsTableSectionType.recentsAndSuggestionsAndSectionIsOne(parameters).isActive {
return suggestions.count
}
return 0
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的回答.
我正在开发一个 Android 应用程序,并且正在使用 recyclerview。我已经成功地显示带有数据的行并对它们应用设计,但我无法获得行的圆角。以下是我的xml文件。
rounded_corners_cards.xml圆角名称的文件:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<stroke android:width="3dp"
android:color="@color/grayLight"/>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"/>
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
文件行:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/StandardListRow"
android:layout_height="60dp"
android:orientation="vertical"
android:background="@drawable/rounded_corners_cards">
<ImageView
android:id="@+id/offer_picture"
style="@style/StyleRowIcon"
android:contentDescription="@string/card_offer_image"
android:scaleType="centerInside" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试过改变rounded_corners_cards.xml文件,但没有成功。
感谢您的建议。