我提交了我的应用程序第2版以供审核,但由于对iCloud的高备份而被拒绝-当时我不知道这一点,因为我只需要在应用程序中拍照即可。现在我尝试转换该代码
NSError *error = nil;
    NSURL *databaseUrl = [NSURL fileURLWithPath:databasePath];
    BOOL success = [databaseUrl setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];
    if(!success){
    NSLog(@"Error excluding %@ from backup %@", [databaseUrl lastPathComponent], error);
    }
Run Code Online (Sandbox Code Playgroud)
很快我就无法工作...这就是我到目前为止...
func excludeFromBackup() {
    var error:NSError?
    var fileToExclude = NSURL.fileURLWithPath("path")
    var success:Bool = fileToExclude?.setResourceValue(NSNumber.numberWithBool(true), forKey: NSURLIsExcludedFromBackupKey, error: &error)
    if success {
        println("worked")
    } else {
        println("didn't work")
    }
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我的numberWithBool值失败。
谁能帮我?有人转换过吗?
提前致谢...
好吧,我有以下代码:
{
    int alfa = CC_RADIANS_TO_DEGREES(atan2(normalized.y, -normalized.x)) + 180;
    NSString * counting = [NSString stringWithFormat:@"fdfg%d.png", alfa];
}
Run Code Online (Sandbox Code Playgroud)
int alfa在0和之间带来一个数字360.
我想要实现的是counting字符串值等于图像文件,我有360个图像文件,都具有这种格式"fdfg0000.png" "fdfg0024.png" "fdfg0360.png",从0增加到360,依此类推......
该%d运营商不读书的价值,因为所有领先的文件名中的零已经由创建它们的程序输出,没有机会对其进行修改,我已经手动360个文件重命名为这样的格式:"fdfg1.png" "fdfg24.png" "fdfg340.png"和多数民众赞成在格式% d正确读取.
所以我的问题是,无论如何要读取原始文件在运算符函数中包含的所有四个零?
或者有没有人知道自动重命名360文件的方法?
我正在Swift中开发一个应用程序,它在一个主旨中告诉人们各种货币的比特币价格.要选择货币,用户可以从具有UITableView的视图控制器中的列表中进行选择.这是currencyViewController,它是从我的主屏幕viewController呈现的.
我想要发生的是,当用户解雇currencyViewController时,它会将一个字符串传递给主viewController中的UIButton.
这是应该传递数据的prepareForSegue函数:
 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
    if (segue.identifier == "presentCurrency") {
        currencySelector.setTitle("\currencySelected", forState: UIControlState.Normal)
    }
}
Run Code Online (Sandbox Code Playgroud)
CurrencySelector是主viewController中的UIButton,而currencySelected是第二个视图控制器currencyViewController中的变量.
它给出错误"文字中无效的转义序列"
所以,我把它缩小到两个问题之一:
来自viewController的变量无法从currencyViewController中"看到".如果是这样,我如何从CurrencyViewController修改CurrencySelector的文本?
出于某种原因,当用户退出推送的CurrencyViewControler时,不会调用prepareForSegue.
这里发生了什么?谢谢,道歉 - 我只是一个快速的新手.
我以编程方式创建了一个UITextView,并添加了一个占位符,如下所示:
    //textView
    textView.frame = CGRectMake(viewSize.width * 0.05, contentView.frame.height - viewSize.width * 0.05, viewSize.width - viewSize.width * 0.05 * 2, -viewSize.height * 0.220833)
    self.textView.delegate = self
    self.textView.text = "Agregue una descripción..."
    self.textView.textColor = UIColor.lightGrayColor()
    self.textView.autocorrectionType = UITextAutocorrectionType.No
    self.textView.layer.cornerRadius = 6
    self.view.addSubview(textView)
Run Code Online (Sandbox Code Playgroud)
并在代表函数中:
func textViewDidBeginEditing(textView: UITextView) {
    if textView.textColor == UIColor.lightGrayColor() {
        textView.text = ""
        textView.textColor = UIColor.blackColor()
    }
}
func textViewDidEndEditing(textView: UITextView) {
    if textView.text.isEmpty {
        textView.text = "Agregue una descripción..."
        textView.textColor = UIColor.lightGrayColor()
    }
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将字符串文本检查为nil:
if textView.text == nil …Run Code Online (Sandbox Code Playgroud) 我很难尝试暂停并从旋转的当前状态继续任何UIView旋转技术.
尝试:
CGAffineTransformRotate
CGAffineTransformMakeRotation
CATransform3DMakeRotation
CABasicAnimation
Run Code Online (Sandbox Code Playgroud)
基本上,如果我打电话view.layer.removeAllAnimations()或,layer.speed = 0他们都重置当前的旋转度.
还试图快照视图以使用图像而不是真正的旋转,但没有运气,因为快照忽略了旋转.
我是 iphone 技术的新手,现在我正在使用一个需要实现推送通知的应用程序。
我按照链接:
http://mobiforge.com/developing/story/programming-apple-push-notification-services#comment-7850
另外,使用了以下代码:
 NSLog(@"Registering for push notifications...");
    [[UIApplication sharedApplication]
  registerForRemoteNotificationTypes:
 (UIRemoteNotificationTypeAlert |
  UIRemoteNotificationTypeBadge | 
  UIRemoteNotificationTypeSound)];
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 
{
    NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
    NSLog(str);
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err 
{ 
    NSString *str = [NSString stringWithFormat: @"Error: %@", err];
    NSLog(str);    
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
{
    for (id key in userInfo) 
 {
        NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
    }    
}
Run Code Online (Sandbox Code Playgroud)
事情是,当我运行程序时,我应该根据代码在调试器窗口中获取设备令牌,而不是我收到如下错误:
" 注册错误。错误:Error Domain=NSCocoaErrorDomain Code=3010 "模拟器不支持远程通知" UserInfo=0x6e055a0 {NSLocalizedDescription=模拟器不支持远程通知} "
我应该如何解决这个问题?
请帮帮我。 …
push-notification apple-push-notifications ios ios-simulator
ios ×5
swift ×4
cocoa-touch ×2
ios8 ×1
nsnumber ×1
nsurl ×1
objective-c ×1
rotation ×1
uitextview ×1
uiview ×1