我为iOS创建了一个自定义日历,我正在尝试使用徽章编号来显示当天的编号,但是在一天过后数字没有变化,我的意思是他们应该更新热闹这里是我的代码:我需要类似天气实时应用程序的东西,此应用程序不发送任何推送通知!
int a = [DateComponents showDay];
[UIApplication sharedApplication].applicationIconBadgeNumber = a ;
Run Code Online (Sandbox Code Playgroud) 我有一个带有settings.bundle的iOS应用程序,它可以处理我的应用程序的各种设置Switch toggle.我在root.plist文件中设置了默认值(使用DefaultValue属性),YES但是只要应用程序在设备或iOS模拟器上启动,所有值都会出现NO.它只在第一次发布时运作良好.

我正在使用此代码检索默认值(我在这里做错了吗?):
NSUserDefaults *localeDefaults = [NSUserDefaults standardUserDefaults];
BOOL ENWORDS = [localeDefaults boolForKey:@"localetime"];
Run Code Online (Sandbox Code Playgroud) 我正在按照本教程尝试将代码从Swift 2.0转换为3.0.但是当我启动应用程序时,该应用程序无法运行!我的意思是,没有任何反应 这是我的代码:
视图控制器:
class ViewController: UIViewController ,BarcodeDelegate {
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let barcodeViewController: BarcodeViewController = segue.destination as! BarcodeViewController
barcodeViewController.delegate = self
}
func barcodeReaded(barcode: String) {
codeTextView.text = barcode
print(barcode)
}
}
Run Code Online (Sandbox Code Playgroud)
BarcodeVC:
import AVFoundation
protocol BarcodeDelegate {
func barcodeReaded(barcode: String)
}
class BarcodeViewController: UIViewController,AVCaptureMetadataOutputObjectsDelegate {
var delegate: BarcodeDelegate?
var captureSession: AVCaptureSession!
var code: String?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
print("works")
self.captureSession = …Run Code Online (Sandbox Code Playgroud) 我试图在地图上显示三件事:GPS(当前位置),Marker 1,Marker 2,但我不确定我做得对不对!这是我的代码:
self.startMarker.position = CLLocationCoordinate2D(latitude: self.startLatitude, longitude: self.startLongitude)
self.startMarker.icon = #imageLiteral(resourceName: "Pin Start")
self.startMarker.map = self.mapView
self.endMarker.position = CLLocationCoordinate2D(latitude: self.endLatitude, longitude: self.endLongitude)
self.endMarker.icon = #imageLiteral(resourceName: "Pin End")
self.endMarker.map = self.mapView
let southWest = CLLocationCoordinate2DMake(self.startLatitude,self.startLongitude)
let northEast = CLLocationCoordinate2DMake(self.endLatitude,self.endLongitude)
let bounds = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
let camera = self.mapView.camera(for: bounds, insets:.zero)
self.mapView.camera = camera!
Run Code Online (Sandbox Code Playgroud)
更多代码:
// MARK: - Google Map
private func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
if status == CLAuthorizationStatus.authorizedWhenInUse {
mapView.isMyLocationEnabled = true
}
}
func …Run Code Online (Sandbox Code Playgroud) 我有xcode 4的疯狂问题,当我想要构建并运行我的应用程序如果模拟器打开xcode崩溃!!!!! 我从来没有遇到过这个问题,我取消了xcode 4.0然后安装新版本4.0.2,但仍有这个问题!

ASSERTION FAILURE in /SourceCache/IDEKit/IDEKit-303/Framework/Classes/Workspace/IDEWorkspaceTabController.m:2327
Details: Assertion failed: [suppressionTargetValue isEqualToString:_kUserDefaults_IDESuppressStopExecutionWarningTargetValue_Add]
Object: <IDEWorkspaceTabController: 0x201464400>
Method: -_showWarningForBuild:forOtherExecution:trackersToStop:taskActionBlock:
Thread: <NSThread: 0x200020700>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x0000000100949773 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1 0x000000010006d394 _DVTAssertionFailureHandler (in DVTFoundation)
2 0x0000000100931e02 -[IDEWorkspaceTabController _showWarningForBuild:forOtherExecution:trackersToStop:taskActionBlock:] (in IDEKit)
3 0x00000001008e830b -[IDEWorkspaceTabController _performContextTask:command:commandName:] (in IDEKit)
4 0x00007fff88486e9a -[NSApplication sendAction:to:from:] (in AppKit)
5 0x00000001001cf63c -[DVTApplication sendAction:to:from:] (in DVTKit)
6 0x000000010085b656 -[IDEApplication sendAction:to:from:] (in IDEKit)
7 0x00007fff884ab41e -[NSMenuItem _corePerformAction] (in AppKit)
8 0x00007fff884ab188 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] …Run Code Online (Sandbox Code Playgroud) 如你所知,iOS 5中的Mail应用程序有一个富文本编辑器,是否有任何可能的方法将此功能用于常规UITextView?

我试图AVPlayer通过UISlider搜索来实现流畅的视频清理,似乎Apple有技术问答并解释了如何实现这一点,但我的问题是如何使用此方法并使用UISlider更改播放器当前时间:
stopPlayingAndSeekSmoothlyToTime(newChaseTime:CMTime)
这是我的代码:
//Play Intro Movie
let videoURL = Bundle.main.url(forResource: "intro", withExtension: "mp4")
player = AVPlayer(url:videoURL!)
let playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.frame
view.layer.addSublayer(playerLayer)
//videoPlayer.play()
view.addSubview(slider)
slider.maximumValue = 0
slider.maximumValue = Float(CMTimeGetSeconds((player.currentItem?.asset.duration)!))
Run Code Online (Sandbox Code Playgroud)
这是Apple示例代码:
func stopPlayingAndSeekSmoothlyToTime(newChaseTime:CMTime)
{
player.pause()
if CMTimeCompare(newChaseTime, chaseTime) != 0
{
chaseTime = newChaseTime;
if !isSeekInProgress
{
trySeekToChaseTime()
}
}
}
func trySeekToChaseTime()
{
if playerCurrentItemStatus == .unknown
{
// wait until item becomes ready (KVO player.currentItem.status)
}
else if playerCurrentItemStatus …Run Code Online (Sandbox Code Playgroud) 我想在视频上添加图片.一切都很好,除了一件事,图像扭曲:
这是代码:
//Capture the image
UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, false, UIScreen.main.scale)
self.captureView.layer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let watermarkVideo = WatermakVideo()
//video file
let videoFile = Bundle.main.path(forResource: "videoTrim", ofType: "mp4")
let videoURL = URL(fileURLWithPath: videoFile!)
let imageFrame = captureView.frame
watermarkVideo.createWatermark(image, frame: imageFrame, video: videoURL)
Run Code Online (Sandbox Code Playgroud)
这是课程WatermakVideo:https:
//www.dropbox.com/s/0d6i7ap9qu4klp5/WatermakVideo.zip
如果你能帮助我解决这个问题,我将不胜感激.
我在iPad上更改应用程序图标时遇到问题.一切都在iPhone上工作正常,但在iPad上我得到这个错误:
[default]无法将preferredIconName设置为AI-Gorgosaurus for ...:0> error:Error Domain = NSCocoaErrorDomain Code = 4"该文件不存在." UserInfo = {NSUnderlyingError = 0x600000248a30 {错误域= LSApplicationWorkspaceErrorDomain Code = -105"iconName在CFBundleAlternateIcons条目中找不到"UserInfo = {NSLocalizedDescription = iconName在CFBundleAlternateIcons条目中找不到}}}应用程序图标因文件不存在而失败.
我搜索广告发现,我需要补充~ipad的CFBundleIconFiles,但仍然得到同样的错误!
这是代码:
func changeIcon(to name: String?) {
//Check if the app supports alternating icons
guard UIApplication.shared.supportsAlternateIcons else {
return;
}
//Change the icon to a specific image with given name
UIApplication.shared.setAlternateIconName(name) { (error) in
//After app icon changed, print our error or success message
if let error = error {
print("App …Run Code Online (Sandbox Code Playgroud)