小编Pet*_*isu的帖子

WKWebView无法在iOS 8下加载本地文件

对于以前的iOS测试版8,负荷(束)本地web应用程序,它都为正常工作UIWebViewWKWebView,我甚至移植使用新的网页游戏WKWebViewAPI.

var url = NSURL(fileURLWithPath:NSBundle.mainBundle().pathForResource("car", ofType:"html"))

webView = WKWebView(frame:view.frame)
webView!.loadRequest(NSURLRequest(URL:url))

view.addSubview(webView)
Run Code Online (Sandbox Code Playgroud)

但在测试版4中,我只是得到了一个空白的白色屏幕(UIWebView仍在工作),看起来没有任何内容被加载或执行.我在日志中看到一个错误:

无法为其创建沙箱扩展 /

有没有帮助引导我走向正确的方向?谢谢!

ios swift ios8 wkwebview

119
推荐指数
6
解决办法
7万
查看次数

strong/weak/retain/unsafe_unretained/assign

用于合成属性的属性: retain/assign

  • 保留 - 保留,旧值被释放并被分配
  • assign - 仅分配

所有权属性: IOS5 =强/弱IOS4 = retain/unsafe_unretained

  • 强大(iOS4 =保留) - 我是主人,你不能解除这个,然后瞄准罚款=保留

  • weak(iOS4 = unsafe_unretained) - 与assign,no retain或release相同

所以unsafe_unretained == assign?

@property (nonatomic, assign) NSArray * tmp;
Run Code Online (Sandbox Code Playgroud)

等于?

@property (nonatomic, unsafe_unretained) NSArray * tmp;
Run Code Online (Sandbox Code Playgroud)

反之亦然?

如果是这样,在iOS4中哪一个更喜欢,或者为什么(unsafe_unretained)如果它与assign完全相同?

并且iOS4中的委托应该是unsafe_unretained还是分配?

cocoa objective-c

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

InterfaceBuilder中的UITableViewHeaderFooterView

我想使用IB在单独的.xib中创建自定义标题部分视图

但是在IB中我找不到组件UITableViewHeaderFooterView(类似于UITableViewCell)并为其分配重用

那么如何在自定义标题部分创建?

我创建了一个继承自UITableViewHeaderFooterView的MySection类创建.xib,MySection.xib注册xib以便重用单元格

问题是,如何使用initWitReuseIdentifier ....

cocoa-touch uitableview

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

iOS7 iPad仅限应用程序,使用UIImagePickerController

我相信这是一个常见的问题,许多答案不再适用,很多只是部分,如果你在iOS7下,你的iPad应用程序只是Landscape,但你想使用UIImagePickerControllerwith source UIImagePickerControllerSourceTypePhotoLibraryUIImagePickerControllerSourceTypeCamera.

如何设置正确,所以它100%工作?并且您没有获得混合方向并避免错误"支持的方向与应用程序没有共同的方向,并shouldAutorotate返回YES".

cocoa-touch uiimagepickercontroller ipad uiinterfaceorientation ios

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

新的itunes连接崩溃日志

如何在新的itunes连接中找到崩溃日志?关于apple的文档,指的是旧的itunes connect,但在新版本中无法找到它

itunesconnect

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

preferredInterfaceOrientationForPresentation必须返回支持的接口方向

此错误没有意义,因为UIInterfaceOrientationLandscapeRight支持的方向返回首选方向

//iOS6

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return (UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft);
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;
}
Run Code Online (Sandbox Code Playgroud)

错误:

由于未捕获的异常'UIApplicationInvalidInterfaceOrientation'而终止应用程序,原因是:'preferredInterfaceOrientationForPresentation必须返回支持的接口方向!'

cocoa ios ios6

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

UIRefreshControl首次运行时标题偏移不正确,有时标题丢失

第一次启动UIRefreshControl时文本被错误地反映...稍后有时刷新文本根本没有出现,只有刺状是可见的

我不认为我对iOS6有这个问题...可能与iOS7有关

在UITableViewController中作为子项添加到VC中,它驻留在一个模态呈现的UINavigationController中

- (void)viewDidLoad {

    [super viewDidLoad];

    [self setRefreshControlText:@"Getting registration data"];
    [self.refreshControl beginRefreshing];
}

- (void)setRefreshControlText:(NSString *)text {

    UIFont * font = [UIFont fontWithName:@"Helvetica-Light" size:10.0];
    NSDictionary *attributes = @{NSFontAttributeName:font, NSForegroundColorAttributeName : [UIColor blackColor]};
    self.refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:text attributes:attributes];

}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在此输入图像描述

cocoa-touch uitableview uirefreshcontrol ios7

29
推荐指数
1
解决办法
9969
查看次数

Crashlytics:适用于二进制图像加载问题的iOS 9解决方法

我正在使用最新的崩解剂获取此警告,如何摆脱它们以及它们的含义是什么?

[Crashlytics] Version 3.3.1 (79)
[Crashlytics:Crash] Warning: iOS 9 workaround for binary image loading issue in place.
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios crashlytics

26
推荐指数
1
解决办法
3652
查看次数

处理openURL:使用Facebook和Google

我的应用中的用户可以使用2种服务登录:Facebook或Google

一切正常,但是,在:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation: (id)annotation {
    ...
}
Run Code Online (Sandbox Code Playgroud)

我应该决定拨打Facebook回拨或Google回调

如果用户有应用程序,它很容易,比我的sourceApplication决定,但当没有(没有本地Facebook帐户链接,没有FB应用程序,没有GooglePlus应用程序),它链接到浏览器:(我不知道它是否是来自Facebook或谷歌

有什么方法可以决定叫什么?喜欢

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation: (id)annotation {

    // how to decide?
    if (facebook) {

        return [FBSession.activeSession handleOpenURL:url];

    } else if (google) {

        return [GPPURLHandler handleURL:url sourceApplication:sourceApplication annotation:annotation];

    }

}
Run Code Online (Sandbox Code Playgroud)

cocoa-touch facebook ios oauth-2.0

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

将selectedTextRange UITextRange转换为NSRange

如何将UITextRange对象转换为NSRange?我已经看到很多关于走向另一个方向的SO帖子,但这与我需要的相反.我正在使用的UITextRange selectedTextRange是一个属性UITextView.它返回一个,UITextRange但我需要一个范围.

objective-c ios nsrange uitextrange

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