标签: ios6

切换隐私设置将终止该应用程序

我有一个使用iPhone的联系人的应用程序.使用iOS 6,第一次尝试时将提示用户输入联系人访问权限.此时,用户可以点击"允许"或"不允许".问题是当用户为应用程序提供背景,然后导航到"设置" - >"隐私" - >"联系人"以切换我的应用程序的"联系人"隐私设置.切换后,我可以在控制台上看到我的应用:

应用程序'UIKitApplication:com.myApp'异常退出,信号9:Killed:9

我在Apple的文档中找不到任何相关信息.有谁知道防止这种情况的方法?这是设计的吗?或者这是一个苹果虫?

objective-c addressbook abaddressbook ios ios6

38
推荐指数
1
解决办法
9642
查看次数

NSDateFormatter显示错误的一年

即时通讯使用xcode 4.5(4G182)与iOS 6. NSDateFormatter在iOS 6中显示错误年份,如何解决?

NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"YYYY-MM-dd"];
NSString *str = [dateFormatter stringFromDate:[NSDate date]];
NSLog(@"%@ == %@",str,[[dateFormatter dateFromString:str] description]);
Run Code Online (Sandbox Code Playgroud)

打印出来" 2012 -09-14 == 2011 -09-13 16:00:00 +0000"

nsdateformatter ios6

37
推荐指数
1
解决办法
9358
查看次数

Facebook SDK 3.1 - 验证访问令牌时出错

我正在尝试将我的应用程序转换到新的Facebook SDK 3.1(支持iOS6身份验证).

我工作得很好,所以我决定从FB网站上的授权应用程序列表中删除该应用程序,以测试iOS是否会再次请求许可.

现在我第一次调用会[FBRequest requestForMe]导致此错误:

响应:

{
  "error": {
    "message": "Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.",
    "type":"OAuthException",
    "code":190,
    "error_subcode":460
  }
}
Run Code Online (Sandbox Code Playgroud)

一些细节:

我正在尝试按如下方式打开会话:

   [FBSession openActiveSessionWithReadPermissions:nil
                                       allowLoginUI:YES
                                  completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {

                                           switch (state) {
                                               case FBSessionStateOpen:
                                                   [self presentPostOptions];
                                                   break;

                                               case FBSessionStateClosed:
                                               case FBSessionStateClosedLoginFailed:
                                                   [FBSession.activeSession closeAndClearTokenInformation]; …
Run Code Online (Sandbox Code Playgroud)

facebook ios facebook-ios-sdk ios6 facebook-sdk-3.1

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

TWOSweetComposeViewController在IOS6中已弃用

我的代码按预期工作只是因为我需要摆脱这个警告消息.在IOS6中不推荐使用TWTeetComposeViewController.是否在ios6中替换了这个内置视图控制器?

这是我的示例代码.

if ([TWTweetComposeViewController canSendTweet]) {
    // Initialize Tweet Compose View Controller
    TWTweetComposeViewController *vc = [[TWTweetComposeViewController alloc] init];
    // Settin The Initial Text
    [vc setInitialText:@"This tweet was sent using the new Twitter framework available in iOS 5."];
    // Adding an Image
    UIImage *image = [UIImage imageNamed:@"sample.jpg"];
    [vc addImage:image];
    // Adding a URL
    NSURL *url = [NSURL URLWithString:@"http://mobile.tutsplus.com"];
    [vc addURL:url];
    // Setting a Completing Handler
    [vc setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
        [self dismissModalViewControllerAnimated:YES];
    }];
    // Display Tweet Compose View Controller Modally
    [self presentViewController:vc …
Run Code Online (Sandbox Code Playgroud)

twitter objective-c ios ios6

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

如何设置UICollectionView动画的持续时间?

我有一个自定义流布局,它正在调整单元格的属性,当它们从CollectionView中插入和删除时具有以下两个函数,但我无法弄清楚如何调整默认动画持续时间.

- (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath {
    UICollectionViewLayoutAttributes* attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath];

    // Assign the new layout attributes
    attributes.transform3D = CATransform3DMakeScale(0.5, 0.5, 0.5);
    attributes.alpha = 0;

    return attributes;
}

- (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath {

    UICollectionViewLayoutAttributes* attributes = [self layoutAttributesForItemAtIndexPath:itemIndexPath];

    // Assign the new layout attributes
    attributes.transform3D = CATransform3DMakeScale(0.5, 0.5, 0.5);
    attributes.alpha = 0;

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

grid collectionview ios ios6

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

在XCode 4.5中使用ZXing库时,架构armv7的未定义符号

我想做什么

在我的iPhone项目中集成Zxing,QR码阅读器框架.我从这里检查了ZXing sdk .我运行了ZXing的示例项目,名为ScanTest,没有任何问题.但是当我尝试将库与我的项目集成时,我收到了提到的错误.

项目规范

  • 目标操作系统:iOS 6.0
  • 部署目标:iOS 5.0或更高版本.
  • 测试:iPhone 4和iPhone 3GS.
  • XCode:Xcode 4.5.1
  • ZXing版:2.0

问题

当我构建时,在完成ZXing自述文件中的每个集成步骤后,我都会遇到构建错误

Undefined symbols for architecture armv7:
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      zxing::qrcode::Detector::computeDimension(zxing::Ref<zxing::ResultPoint>, zxing::Ref<zxing::ResultPoint>, zxing::Ref<zxing::ResultPoint>, float) in libZXingWidget.a(Detector-B8B28E953F840D47.o)

Undefined symbols for architecture armv7:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
      zxing::Exception::Exception(char const*) in libZXingWidget.a(Exception.o)
      zxing::common::StringUtils::guessEncoding(unsigned char*, int, std::map<unsigned int, std::string, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::string> …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch undefined-symbol zxing ios ios6

37
推荐指数
4
解决办法
3万
查看次数

从一个UICollectionViewLayout切换到另一个UICollectionViewLayout时的自定义动画?

作为测试,我做了一个布局,在垂直线上显示单元格,另一个在水平布局中显示它们.当我把[collectionView setCollectionViewLayout:layout animated:YES];它称为两个位置之间的动画非常干净.

现在,我喜欢做的是有各方面的意见做了几个旋转,扭曲,最后到达目的地之前的屏幕(可能使用CAKeyframeAnimations)左右翻转,但我不能找到一个好地方挂钩这一点.

我尝试了子类化UICollectionViewLayoutAttributes以包含动画属性,然后applyLayoutAttributes:UICollectionViewCell我正在使用的重写方法中设置这些动画.这可行...除了它似乎只布局转换完成才会发生.如果我想使用它,我必须让布局不要立即改变对象的当前位置,只有在它到达代码的这个apply属性部分之后,这似乎很多工作......

或者我可以继承UICollectionView和覆盖setCollectionViewLayout:animated:,但在布局之间看起来似乎也有很多状态.无论这些optins的似乎是正确的,因为有这样的动画细胞的添加/删除一个简单的方法的布局.我觉得应该有类似的东西挂钩布局之间的动画.

有谁知道获得我想要完成的目标的最佳方法?

objective-c ios6 uicollectionview uicollectionviewlayout

37
推荐指数
1
解决办法
2808
查看次数

MFMailComposeViewController抛出viewServiceDidTerminateWithError,然后在使用自定义标题字体时退出

我遇到了很长一段时间里遇到的最奇怪的问题......而且我的想法已经用完了.

所以我有一个MFMailComposeViewController,它是通过点击UIButton启动的,它正在启动邮件编辑器视图.你看到我分配的主题,但在to:或body字段填充之前,窗口会闪烁并消失.它抛出此错误:

viewServiceDidTerminateWithError:Error Domain = XPCObjectsErrorDomain Code = 2"无法完成操作.(XPCObjectsErrorDomain error 2.)"

现在这里是疯狂的部分.如果我切换到另一个也使用MFMailComposeViewController的应用程序并启动那个,然后切换回我的应用程序并再次启动邮件编辑器,它工作得很好.我无法解释.

这似乎只是运行iOS 6且不是 iPhone 5的手机的问题.

我四处搜寻,似乎找不到其他人遇到同样的问题.有人有什么建议吗?

我已经将MessageUI.framework链接起来了,我也发现这不能在模拟器或设备上工作,但是当我还链接Security.framework时它开始在模拟器中工作,但它仍然不起作用在设备上.

我的启动MFMailComposeViewController的代码如下:

在.h文件中

#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
Run Code Online (Sandbox Code Playgroud)

在.m文件中

-(void)displayComposerSheet {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Support Request"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"support@domain.com"];

[picker setToRecipients:toRecipients];

// Fill out the email body text
NSString *emailBody = @"\n\nEmail from iOS";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];
}


// Dismisses the email composition interface when users tap …
Run Code Online (Sandbox Code Playgroud)

objective-c ios ios6

36
推荐指数
4
解决办法
9880
查看次数

尝试显示*on*,其视图不在窗口层次结构中

我正在尝试在我的app委托中创建一个模态视图控制器(我创建了一个名为showLoginView的函数).但每当我尝试调用它时,我会在XCode中收到警告:

Warning: Attempt to present <PSLoginViewController: 0x1fda2b40> on <PSViewController: 0x1fda0720> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)

这是方法代码:

- (void)showLoginView
{
    PSLoginViewController *loginViewController = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:@"PSLoginViewController"];
    [self.window.rootViewController presentViewController:loginViewController animated:NO completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

如何将视图添加到窗口层次结构?或者也许我做错了什么?

cocoa-touch objective-c ios ios6

36
推荐指数
5
解决办法
5万
查看次数

UIButton titleLabel不显示

我见过一堆类似的问题,但没有人得到我想要的答案.当我使用此代码制作UIButton并将其设置为titleLabel时,会出现UIButton,但不会出现titleLabel.

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
[button setBackgroundImage:[UIImage imageNamed:@"button.png"] forState:UIControlStateNormal];
button.titleLabel.text = @"Title";
button.titleLabel.font = [UIFont fontWithName:@"System-Bold" size:25.0f];
[self.view addSubview:button];
Run Code Online (Sandbox Code Playgroud)

此代码显示按钮,但不显示titleView,它的标题.为什么会这样?我正在为iOS 6及更高版本开发.

注1:我不是在寻找这样的选项:

[button setTitle:@"Title" forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

因为我必须使用titleLabel来设置它的font和fontSize.

注意2:我无法创建UILabel并将其添加为按钮的子视图.由于按钮后来是动画.

iphone uibutton ios ios6

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