iOS开发常见问题收集10个1,插件失效

来源:互联网 发布:学java看书还是看视频 编辑:程序博客网 时间:2024/05/08 18:00

问:升级Xcode7之后VVDocumenter-Xcode不能用了怎么办?答:解决办法在这里:http://www.iswifting.com/2015/12/01/VVDocumenter-Xcode-xcode7-nowork/

2,模拟器启动错误
问:模拟器启动错误:The operation couldn’t be completed. (LaunchServicesError error 0

答:进到你当前程序的沙盒,删除掉应用,在运行即可!

3,横屏
问:- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation NS_DEPRECATED_IOS(2_0,8_0)

__TVOS_PROHIBITED;这个接口在IOS9上不起作用了,我该用哪个接口?答:iOS 8 旋转之后调用:

iOS 9有一些改变:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation NS_DEPRECATED_IOS(2_0,8_0)__TVOS_PROHIBITED;

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator{

//

[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context){

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];// do whatever

NSLog(@"*****");

} completion:^(id<UIViewControllerTransitionCoordinatorContext> context){

NSLog(@"");}];

[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];}

http://stackoverflow.com/questions/24071453/rotation-methods-deprecated-equivalent-of-didrotatefrominterfaceorientation

4,类似腾讯新闻问:在XCode中如何使用UISegmentControl控制多界面

答:类似腾讯新闻是吧:https://github.com/worldligang/iOSStrongDemo5,cocoapods查看版本

问:如何查看AFNetworking版本答:pod search AFNetworking

6,查看frame
问:调试的时候 怎么查看viewframe信息?

答:

7,定位问:在iOS8中使用CoreLocation进行定位问题

答:

1iOS7只要开始定位,系统就会自动要求用户对你的应用程序授权.但是从iOS8开始,想要定位必须先"自己""主动"要求用户授权,需要调用以下其中一个方法:

(1)始终允许访问位置信息

(2)使用应用程序期间允许访问位置数据

示例如下:

2.iOS8中不仅仅要主动请求授权,而且必须再info.plist文件中配置一项属性才能弹出授权窗口,在Info.plist文件中添加如下配置:

这两个键的值就是授权alert的描述,示例配置如下[勾选Show Raw Keys/Values后进行添加]:

注意:如果配置好了之后模拟器跑起来后没动静,不会调用代理方法- (void)locationManager:(CLLocationManager)manager didUpdateLocations:(NSArray)locations取不到定位信息的话,有可能是模拟器的bug,你设置一下模拟器模拟跑步或者模拟开车然后重新跑起来应该就可以。 模拟器设置:Debug-Location-City Run

- (void)requestAlwaysAuthorization;

- (void)requestWhenInUseAuthorization;

self.locationManager = [[CLLocationManager alloc]init];_locationManager.delegate = self;_locationManager.desiredAccuracy = kCLLocationAccuracyBest;_locationManager.distanceFilter = 10;

[_locationManager requestAlwaysAuthorization];//[_locationManager startUpdatingLocation];

1NSLocationWhenInUseDescriptionGPS2NSLocationAlwaysUsageDescriptionGPS

8,证书
问: 升级Xcode7之后VVDocumenter-Xcode不能用的解决办法

答:不需要参考:http://www.iswifting.com/2015/12/01/VVDocumenter-Xcode-xcode7-nowork/

9,第一次进入问:如何判断是否是第一次进入一个controller

答:这个问题跟判断是否第一次进入APP相似,代码如下:

10,常见URL Scheme问:有哪些常用的URL Scheme

答:下面给出微信、新浪微博、QQ、支付宝的白名单:

if(![[NSUserDefaults standardUserDefaults] boolForKey:@"firstStart"]){[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstStart"];NSLog(@"");

}else{NSLog(@"");

}

<!-- URL Scheme--><string>wechat</string><string>weixin</string>

<!-- URL Scheme--><string>sinaweibohd</string><string>sinaweibo</string><string>sinaweibosso</string><string>weibosdk</string><string>weibosdk2.5</string>

<!-- QQQzone URL Scheme --><string>mqqapi</string><string>mqq</string><string>mqqOpensdkSSoLogin</string><string>mqqconnect</string><string>mqqopensdkdataline</string><string>mqqopensdkgrouptribeshare</string><string>mqqopensdkfriend</string><string>mqqopensdkapi</string><string>mqqopensdkapiV2</string><string>mqqopensdkapiV3</string><string>mqzoneopensdk</string><string>wtloginmqq</string><string>wtloginmqq2</string><string>mqqwpa</string><string>mqzone</string><string>mqzonev2</string><string>mqzoneshare</string><string>wtloginqzone</string><string>mqzonewx</string><string>mqzoneopensdkapiV2</string><string>mqzoneopensdkapi19</string><string>mqzoneopensdkapi</string><string>mqzoneopensdk</string>

<!-- URL Scheme--><string>alipay</string><string>alipayshare</string>

更多iOS相关技术,请微信扫描关注: 转载自李刚大神的博客,欢迎关注

0 0
原创粉丝点击