小编Ama*_*mar的帖子

Cocoa错误262,无法将文件上传到iCloud

我正在尝试使用以下代码行将大文件上传到iCloud:

-(void)uploadFileWithFilePath:(NSString *)Path toFileURLInCloud:(NSURL *)destURL{
    NSURL * filePath = [NSURL URLWithString:Path];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void)
    {
        NSFileCoordinator* fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
        [fileCoordinator coordinateReadingItemAtURL:filePath
                            options:NSFileCoordinatorReadingWithoutChanges
                              error:nil
                         byAccessor:^(NSURL *newURL)
        {
            NSFileManager * fileManager = [[NSFileManager alloc] init];
            NSError * error;
            BOOL success = [fileManager copyItemAtURL:filePath toURL:destURL error:&error];
            if (success) {
                NSLog(@"Copied %@ to %@", filePath, destURL);
            }
            else {
                NSLog(@"Failed to copy %@ to %@: %@", filePath, destURL, error.localizedDescription);
            }
        }];
    });
}
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

The operation couldn’t be completed. (Cocoa error 262.) …
Run Code Online (Sandbox Code Playgroud)

iphone ios icloud

4
推荐指数
1
解决办法
2332
查看次数

电话号码格式ios

在我的应用程序中,我将电话号码作为用户的输入.号码应采用美国格式.我想动态地显示它(555)-888-888.例如,当用户在达到4位时开始输入数字时,它显示如下的数字(555)-4,依此类推.我试过replaceString方法,但我发现它不起作用.

nsstring ios

4
推荐指数
2
解决办法
7779
查看次数

声纳抛出错误BadDatabaseVersion

我在服务器A和服务器B上安装了声纳和mysql数据库.我正在尝试使用声纳运行器进行声纳分析,但每次出现以下错误:

Caused by: java.lang.RuntimeException: wrapper
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
    ... 22 more
Caused by: org.sonar.core.persistence.BadDatabaseVersion: The current batch process and the configured remote server do not share the same DB configuration.
    - Batch side: jdbc:mysql://xx.xx.xx.xx:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true (sonar / *****)
    - Server side: check the configuration at http://xx.xx.xx.xx:9000/system
Run Code Online (Sandbox Code Playgroud)

服务器B正在从服务器A访问数据库.我检查了批处理和服务器端的所有配置,一切似乎都没问题.

我也用Google搜索并找到以下链接,但我无法理解如何解决此问题.

有什么指针吗?

sonarqube

3
推荐指数
1
解决办法
3371
查看次数

将之前添加的视图添加到前面

我的问题如下:

我有一个视图,该视图我添加3子视图(view1,view2,view3按该顺序).视图略有重叠.我想把第一个视图带到顶部,但我无法让它工作.

我尝试添加视图insertSubview:atIndex:并给出view1更大的索引,我尝试使用addSubview:然后使用SubviewToTop,但似乎没有任何工作.

有任何想法吗?

PS我无法以不同的顺序添加视图.它们必须按此顺序添加.

subview uiview addsubview ios

3
推荐指数
1
解决办法
8014
查看次数

IE8 ajax Coldfusion中的预期标识符,字符串或数字

我在我的代码中面临问题.它在IE8中出现javascript错误,

"SCRIPT1028: Expected identifier, string or number"  
Run Code Online (Sandbox Code Playgroud)

我的代码,

<cfoutput>
<cfif iPro eq "M">
<cfset iIdLock = #DecryptX(iId)#>`

<script>
window.onbeforeunload = function(){
    var hook = true;
    if(hook){
        var r="#iIdLock#";
       $.ajax({                     
           type:'POST',
           async:false,
           url:"setlock.cfm",
           data:"s="+r,
           success: function(){},
           error: function(){},
        });
    }
}
</script>

</cfif>
</cfoutput>
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?

ajax coldfusion internet-explorer-8

3
推荐指数
1
解决办法
1500
查看次数

尝试圆形图像,输出菱形?

我有一个奇怪的问题.我正在解析数据并提取图像的URL,然后将其设置为单元格' imageView'.从我能理解的,我应该设置'的大小'cornerRadius '为图像高度的一半.因为我将数据拉入高度为100的表格视图单元格中,所以我将角半径设置为50.

然而,当视图加载到图像的第一个初始载荷上时,它们就像小钻石一样出现.当我旋转设备(也旋转表格视图)时,它会自动恢复全尺寸图像,也具有圆度.

这是初始加载的示例图像,

在此输入图像描述

有人知道为什么会这样吗?

这是我的tableView代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    NSDictionary *generatedUsers = [self.randomlyGeneratedUsersArray objectAtIndex:indexPath.row];
    NSURL *url = [NSURL URLWithString:[generatedUsers valueForKeyPath:@"user.picture"]];
    cell.textLabel.text = [NSString stringWithFormat:@"%@ %@", [generatedUsers valueForKeyPath:@"user.name.first"], [generatedUsers valueForKeyPath:@"user.name.last"]];
    cell.detailTextLabel.text = [generatedUsers valueForKeyPath:@"user.location.street"];
    [cell.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholder"]];

    cell.imageView.layer.cornerRadius = 50.0f;
    cell.imageView.layer.masksToBounds = YES;

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiimageview uiimage ios

3
推荐指数
1
解决办法
1276
查看次数

修剪NSDate仅显示日期

我已经经历了所有类似的问题,不幸的是非解决我的问题所以我问了.我需要我的函数返回一个NSDate唯一的日期,但我的返回值也包含时间,我已经尝试了setTimeStyle noStyle以及我能提出的每个可能的解决方案,这里是代码:

-(NSDate*)stringToDate{
    NSString *dateString = @"01-02-2010";
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    NSDate *date;
    date = [dateFormatter dateFromString:dateString];
    NSLog(@"%@",date);
    return date;
} 
Run Code Online (Sandbox Code Playgroud)

输出是: 2010-01-31 16:00:00 +0000

我想要的是: 2010-01-31

iphone objective-c nsdate nsdateformatter ios

3
推荐指数
1
解决办法
9476
查看次数

Admob插页式广告 - 无法呈现插页式广告.还没有准备好

此代码是否正确实施插页式广告?

在此输入图像描述

因为当我发射它时,我得到了这个,

<Google> Cannot present interstitial.  It is not ready.
Run Code Online (Sandbox Code Playgroud)

ads interstitial admob ios

3
推荐指数
1
解决办法
9551
查看次数

为什么在ObjectiveC中参数之前有一个"_"?

我是iOS开发的新手,并且正在研究Bluetooth Low Energy (BLE, Bluetooth 4.0)IOS.

我看到了一些示例代码,如下所示:

@property (strong, nonatomic) CBPeripheralManager *peripheralManager;

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Start up the CBPeripheralManager
    _peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
}
Run Code Online (Sandbox Code Playgroud)

The question is :

为什么在externalManager之前添加"_" ViewDidload

对不起我的英语和任何愚蠢的......

提前致谢.

objective-c ios

3
推荐指数
1
解决办法
128
查看次数

ACAccount标识符对所有设备都是唯一的吗?

属性标识符ACAccount是否对所有设备都是唯一的?

文档无法说明任何内容,只是"唯一标识符".在一台设备上还是在所有设备上?

iphone ios acaccount

2
推荐指数
1
解决办法
153
查看次数