我正在使用fastlane来处理配置.
这就是我做的:
match nuke development
match nuke distribution
Run Code Online (Sandbox Code Playgroud)
然后在一个通道中,我为每个bundleId提供了这个我需要提供的内容:
match(type: "development", app_identifier: "com.myCompany.myApp", force_for_new_devices: true)
Run Code Online (Sandbox Code Playgroud)
当我想下载配置时,我有一个执行此操作的通道:
match(type: "development", app_identifier: "com.myCompany.myApp", readonly: true)
Run Code Online (Sandbox Code Playgroud)
所有这些让我可以在nuke时门户网站上的设备上工作和构建.
如果要添加设备,如何正确更新配置?
我试过这个:
match development --force_for_new_devices true -a com.myCompany.myApp
Run Code Online (Sandbox Code Playgroud)
这是行不通的.
我收到此错误:
Provisioning profile '82afbd5b-9f19-4c78-b3ac-56a3565ce3f2' is not available on the Developer Portal
Run Code Online (Sandbox Code Playgroud)
每次我必须添加一个设备时唯一有效的方法是核对一切并重新开始.
什么是添加设备而不必核武器的正确方法?
我正在使用xcode8,我禁用了fastlane建议的自动配置.
我正在开发一个使用核心数据的iOS项目.我正在使用swift.Core Data堆栈设置正确,一切似乎都没问题.我为一个名为TestEntity的实体(NSManagedObject)创建了一个类.这个类看起来像这样:
import UIKit
import CoreData
class TestEntity: NSManagedObject {
@NSManaged var name: NSString
@NSManaged var age: NSNumber
}
Run Code Online (Sandbox Code Playgroud)
那么,我尝试使用以下代码行在代码中插入一个新的TestEntity:
let te: TestEntity = NSEntityDescription.insertNewObjectForEntityForName("TestEntity", inManagedObjectContext: ctx) as TestEntity
Run Code Online (Sandbox Code Playgroud)
然后我得到这个错误:

我已经看到堆栈溢出的一些答案,说我需要担心模块名称.那么我在文档上看了一下:https: //developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/WritingSwiftClassesWithObjective-CBehavior.html
然后我进入了TestEntity的核心数据实体,在类字段中我输入了myAppName.TestEntity
当我运行应用程序时这一行:
let te: TestEntity = NSEntityDescription.insertNewObjectForEntityForName("TestEntity", inManagedObjectContext: ctx) as TestEntity
Run Code Online (Sandbox Code Playgroud)
仍然给我同样的错误.
还有什么我可能做错了?
编辑:所以,通过将TestEntity NSManagedObject类更改为:导入UIKit导入CoreData,我能够使应用程序不再崩溃
@objc(TestEntity) class TestEntity: NSManagedObject {
@NSManaged var name: NSString
@NSManaged var age: NSNumber
}
Run Code Online (Sandbox Code Playgroud)
所以,我在其中添加了@objc(TestEntity).无论是否在核心数据数据模型检查器中的TestEntity类名称之前添加appName,都可以使用此方法.
这可行,但是,当我运行测试时,这一行仍然崩溃:
let te: TestEntity = NSEntityDescription.insertNewObjectForEntityForName("TestEntity", inManagedObjectContext: ctx) as TestEntity
Run Code Online (Sandbox Code Playgroud)
所以我发现这对其他人来说是个问题: 如何在测试目标中访问Core …
我整理了一个测试应用程序,只是为了通过我们的企业开发人员帐户测试内部分发.
在归档之前,我检查了所有签名设置看起来都很好.Debug和Release显示正确的配置文件和证书.
然后我存档应用程序.提示显示:
显示正确的证书和配置文件.随着存档路由的继续,我进入这个屏幕:
我试图理解为什么它说:证书"未知"和配置文件"无"
当我尝试通过我们的MDM解决方案分发它时,它永远不会安装.
我的问题是:在分发内部企业应用程序时,看到证书"未知"和配置文件"无"是否正确?
我有这样的看法:
struct TheFullCover: View {
@State var showModal = false
var body: some View {
Button(action: {
showModal.toggle()
}) {
Text("Show Modal")
.padding()
.foregroundColor(.blue)
}
.background(Color(.white))
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(.red, lineWidth:1)
)
.fullScreenCover(isPresented: $showModal, onDismiss: {
}, content: {
VStack {
Text("Here I am")
TheFullCover()
}
})
}
}
Run Code Online (Sandbox Code Playgroud)
每次我按下按钮时,模式屏幕都会全屏显示。一切都很好。
问题:
如何禁用向上滑动动画?我希望视图立即全屏呈现,而不需要动画。
有没有办法做到这一点?
我试图在swift中编写自定义初始化程序.我有这样的事情:
convenience init(datasource:SomeProtocol) {
assert(datasource != nil, "Invalid datasource")
if(datasource == nil) {
return nil
}
self.init()
}
Run Code Online (Sandbox Code Playgroud)
"return nil"行给出了这个错误:"找不到接受提供的参数的'__version'的重载"
所以,我想要完成的就是让这个便利初始化器返回nil,如果调用者没有提供有效的数据源.
我在这做错了什么?
谢谢
所以我习惯了UIImageView,并能够设置不同的方式来显示图像.比如AspectFill模式等......
我想在Mac应用程序上使用NSImageView完成同样的事情.在这方面,NSImageView的工作方式与UIImageView类似吗?或者我将如何在NSImageView中显示图像并选择不同的方式来显示该图像?
我在swift中这样做:
let date = NSDate(timeIntervalSince1970: 1432233446145.0)
println("date is \(date)")
Run Code Online (Sandbox Code Playgroud)
日志给了我这个:
date is 47355-09-02 23:55:45 +0000
Run Code Online (Sandbox Code Playgroud)
然后我尝试将一个间隔退出,仅用于测试:
let tI = expirationDate.timeIntervalSinceDate(date)
println("tI = \(tI)")
Run Code Online (Sandbox Code Playgroud)
我明白了:
tI = 0.0
我究竟做错了什么?我似乎可以使timeIntervalSince1970调用正常工作.在Swift中是否有任何已知的发布,或者我在这里遗漏了什么?
我正在采用新的async/awaitSwift API。事情进展顺利。目前,在我的应用程序中,我使用 GCD 串行队列作为管道来强制任务连续发生。
为了操作应用程序中某些关键模型的数据,我使用可从应用程序中的任何位置访问的串行队列:
let modelQueue = DispatchQueue(label: "com.myapp.updatemodelqueue")
Run Code Online (Sandbox Code Playgroud)
每当模型需要修改一些模型数据时,我都会分派到该队列:
modelQueue.async {
// ... model updates
}
Run Code Online (Sandbox Code Playgroud)
通过我所做的新async/await更改,我仍然希望强制模型实际更新连续发生。因此,例如,当我从服务器导入新模型数据时,我想确保它们连续发生。
例如,我的模型中可能有一个如下所示的调用:
func updateCarModel() async {
let data = await getModelFromServer()
modelQueue.async {
// update model
}
}
Run Code Online (Sandbox Code Playgroud)
然而,使用该模式编写该函数不会等待模型更新更改,因为modelQueue.async. 我不想使用modelQueue.sync以避免死锁。
因此,在观看 WWDC 视频并查看文档后,我利用以下方式实现了withCheckedContinuation:
func updateCarModel() async {
let data = await getModelFromServer()
await withCheckedContinuation({ continuation in
modelQueue.async {
// update model
continuation.resume()
}
})
}
Run Code Online (Sandbox Code Playgroud)
然而,据我了解,withCheckedContinuation真正的目的是让我们逐步过渡以完全采用新的async/awaitSwift API。所以,这似乎不是我应该使用的最终方法。
然后我查看了 …
在CATransaction中,我有以下代码:
[CATransaction setCompletionBlock:^{
...do something ....
}];
Run Code Online (Sandbox Code Playgroud)
动画运行大约半秒钟.如果在类逻辑中发生其他一些事件,我希望能够取消完成块...
有没有办法阻止这个块在动画开始后运行?
我在SceneDelegate中定义了一个let属性。我希望某些ViewController能够在场景中访问它。
在UIKit中,我可以访问App Delegate属性,如下所示:
UIApplication.shared.delegate
Run Code Online (Sandbox Code Playgroud)
然后强制转换并指定属性名称...
是否有等效的方法可以从UIViewController的实例获取对视图控制器所在的SceneDelegate的引用?
ios ×5
swift ×5
async-await ×1
core-data ×1
fastlane ×1
macos ×1
nsdate ×1
nsimageview ×1
swiftui ×1