小编Mat*_*uch的帖子

来自不兼容类型'ViewController*const_strong'的'id <MFMailComposeViewControllerDelegate>'

在我的应用程序中,我有一个按钮,当按下时打开一个电子邮件,填写"to"和"subject",但我在这行代码上收到此警告:

mc.mailComposeDelegate = self; 
Run Code Online (Sandbox Code Playgroud)

警告说:

Assigning to 'id<MFMailComposeViewControllerDelegate>'from incompatible type 'ViewController *const_strong'

我该怎么办?请非常清楚,我对xCode不太熟练.

xcode objective-c mfmailcomposeviewcontroller

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

MPVolumeView AirPlay按钮未显示

使用MPVolumeView我想为应用程序的音频创建一个AirPlay输出按钮.

MPVolumeView *volumeView = [ [MPVolumeView alloc] initWithFrame:CGRectMake(20, 20, 220, 20)];
    [volumeView setShowsVolumeSlider:NO];
    [volumeView setShowsRouteButton:YES];
    [volumeView sizeToFit];
    [self.view addSubview:volumeView];
    [volumeView release];
Run Code Online (Sandbox Code Playgroud)

错误/问题没有,但它没有出现,任何想法?
谢谢!

objective-c ios airplay mpvolumeview

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

代码签名:指定要求的标识符与应用程序标识符不匹配

我有一个codesign无法完全验证的应用程序,因为它“不满足其指定的要求”。第一次检查返回“在磁盘上有效”,所以没关系。

codesign -dvvvv -r- PATH_TO_APP 告诉我要求,它是:

Identifier=com.foobar.BarBuz-Helper
[...]
designated => anchor apple generic and identifier "com.foobar” and
  (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or 
  certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and 
  certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and 
  certificate leaf[subject.OU] = XXXXXXXXXX)
Run Code Online (Sandbox Code Playgroud)

看起来正确。除了应用程序的标识符实际上不是“com.foobar”而是“com.foobar.BarBuz-Helper”,在我看来这就是它不满足其要求的原因。

Xcode 使用错误的标识符对应用程序进行签名。这是运行的 Xcode 命令:

CodeSign /Users/matthias/[…]-Helper
    setenv CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    Using code signing identity "Developer ID Application: Matthias Bauch"
    /usr/bin/codesign --force --sign 0123456789 --requirements =designated\ =>\ anchor\ apple\ generic\ \ and\ identifier\ \"com.foobar\"\ and\ ((cert\ leaf[field.1.2.840.113635.100.6.1.9]\ exists)\ or\ (\ …
Run Code Online (Sandbox Code Playgroud)

macos xcode code-signing

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

正在主线程上执行长时间运行的操作.迅速

在我的ProfileViewController我有一个查询,检索存储为PF文件的用户个人资料图片.

  var query = PFQuery(className:"Users")
    query.whereKeyExists("profilePicture")
    query.findObjectsInBackgroundWithBlock {
        (objects: [AnyObject]!, error: NSError!) -> Void in
        if error == nil {

            self.userNameLabel.text = PFUser.currentUser().username

            if let imageFile = PFUser.currentUser().objectForKey("profilePicture") as? PFFile {
                if let data = imageFile.getData() {
                    self.profPic.image = UIImage(data: data)
                }
            }

        }
        else {
            println("User has not profile picture")
        }
    }
Run Code Online (Sandbox Code Playgroud)

这是此视图中唯一的查询,我的应用程序主页中有另一个查询,其中包含所有用户的所有帖子.我得到的错误是A long-running operation is being executed on the main thread.跟着Break on warnBlockingOperationOnMainThread() to debug.

我不知道如何解决这个问题,特别是因为我需要做另一个查询来获取当前用户发布的配置文件.我应该使用除了以外的东西吗findObjectsInBackgroundWithBlock?谢谢.

iphone ios parse-platform swift

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

使用CAKeyframeAnimation和path的间歇fillMode = kCAFillModeForwards错误

当我使用CAKeyframeAnimation在屏幕上移动UIImageView时,我遇到了间歇性问题.我希望UIImageView的位置保持在动画完成时结束的位置.此错误仅发生在某些起点和终点.当我使用随机点时,它大部分时间都能正常工作,但大约有5-15%的时间失败并快速回到动画前的位置.只有在使用路径属性使用CAKeyframeAnimation时才会出现此问题.如果我使用values属性,则不会出现错误.我设置removedOnCompletion = NO,并且fillMode = kCAFillModeForwards.我在下面发布了一个测试Xcode的链接.这是我设置动画的代码.我有一个属性usePath.如果是YES,则会出现错误.当我将usePath设置为NO时,不会发生快照错误.在这种情况下,我使用的是一条简单的路径,但是一旦我用一条简单的路径解决了这个bug,我将使用一条带有曲线的更复杂的路径.

// create the point        
CAKeyframeAnimation *moveAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
if (self.usePath) {
    CGMutablePathRef path = CGPathCreateMutable();
    CGPathMoveToPoint(path, NULL, startPt.x, startPt.y);
    CGPathAddLineToPoint(path, NULL, endPt.x, endPt.y);
    moveAnimation.path = path;
    CGPathRelease(path);    
} else {
    moveAnimation.values = [NSArray arrayWithObjects:
                            [NSValue valueWithCGPoint:startPt],
                            [NSValue valueWithCGPoint:endPt],
                            nil];
}
moveAnimation.calculationMode = kCAAnimationPaced;
moveAnimation.duration = 0.5f;
moveAnimation.removedOnCompletion = NO;
// leaves presentation layer in final state; preventing snap-back to original state
moveAnimation.fillMode = kCAFillModeForwards; 
moveAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
// moveAnimation.delegate = self;    

// start …
Run Code Online (Sandbox Code Playgroud)

iphone core-animation iphone-sdk-3.0 cakeyframeanimation

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

iPhone CoreData加入

这是我的核心数据模型:

在此输入图像描述

我正在尝试从给定category.categoryName和languageset.languageSetName的数据库中获取所有LanguageEntries,例如

NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init];

    NSEntityDescription *entity = [NSEntityDescription entityForName:@"LanguageEntry" inManagedObjectContext:del.managedObjectContext];
    [fetchRequest setEntity:entity];

NSString* predicateString = [NSString stringWithFormat:@"Category.categoryName = %@ AND LanguageSet.languageSetName = %@", 
                        @"Food", @"English####Spanish"];

fetchRequest.predicate = [NSPredicate predicateWithFormat:predicateString];

NSError *error = nil;
NSArray* objects = [del.managedObjectContext executeFetchRequest:fetchRequest error:&error];
Run Code Online (Sandbox Code Playgroud)

这总是返回0个对象.如果我将谓词字符串设置为匹配一个关系(例如,Category.categoryName = Food或languageSet.languageSetName = English #### Spanish),它将返回数据.

这令人费解,任何人都可以解释一下吗?

- >肯

sqlite core-data iphone-sdk-3.0

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

如何在iOS应用中使用电子邮件?

请告诉我如何发送电子邮件?

这意味着我有一个uibutton当用户点击我想从应用程序检索一些数据并将其发送到技术助手的邮件ID ..有没有任何简单的方法来做到这一点?

email iphone

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

核心文本 - 在iPhone中选择文字?

我需要在视图中使用Core Text渲染富文本(简单格式化,一行文本中的多种字体等).我想知道用户使用(标准复制/粘贴功能)是否可以选择以这种方式呈现的文本?

iphone core-text

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

检测null和"null"类似的JSON值?Xcode中

我在将数据插入tableView中的单元格时遇到问题.当我搜索错误源时,我看到我的webservice正在返回null值.因此,当我将名称调用到单元格时,它会崩溃参数为null.因此,原因是数据库问题,我只想跳过添加例如:{"name":"null"}的问题

在其他服务中,我得到空值空...所以它不会导致问题..我认为它是一个字符串的空值.

这是一个例子:

{
    "24_7" = 0;
    address = "avenue innsbruck";
    city = GRENOBLE;
    country = FR;
    dst = "14007.2046741012";
    "h_saturday" = " - ";
    "h_sunday" = " - ";
    "h_week" = " - ";
    id = 324;
    "location_lat" = "45.154";
    "location_long" = "5.73387";
    name = "<null>";
    "tel_1" = 0476544254;
    "tel_2" = "";
    zipcode = 38000;
}
Run Code Online (Sandbox Code Playgroud)

我只想在这里解析json时跳过添加这个.

NSString *theJSON = [request responseString];

SBJsonParser *parser = [[SBJsonParser alloc] init];

NSDictionary *jsonDictionary = [parser objectWithString:theJSON error:nil];

//NSLog(@"OkRequest || %@ ", jsonDictionary); …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios sbjson

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

UITableViewCell中的字幕对齐

我正在尝试在单元格中构建带有字幕文本的表格视图

问题是,当我尝试将字幕文本的对齐方式设置为右侧时,它不起作用,但它与主文本一起正常工作

这是我的代码

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"CustomCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    [[cell textLabel] setTextAlignment:UITextAlignmentRight];
    [[cell detailTextLabel] setTextAlignment:UITextAlignmentRight];

    cell.textLabel.text = [array objectAtIndex:indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:18];
    cell.detailTextLabel.text = @"test";
    return cell;
}
Run Code Online (Sandbox Code Playgroud)

当我删除字幕代码时,对齐工作正常

任何的想法 ?

cocoa-touch uitableview uilabel

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