小编Luk*_*asz的帖子

如何开发或迁移iPhone 5屏幕分辨率的应用程序?

新的iPhone 5显示器具有新的宽高比和新的分辨率(640 x 1136像素).

开发新的或已经过渡的现有应用程序到新屏幕尺寸需要什么?

我们应该记住什么使应用程序对于旧显示器和新的宽屏宽高比"通用"?

iphone screen ios iphone-5

496
推荐指数
18
解决办法
15万
查看次数

关闭使用非转义参数可能允许它逃脱

我有一个协议:

enum DataFetchResult {
    case success(data: Data)
    case failure
}

protocol DataServiceType {
    func fetchData(location: String, completion: (DataFetchResult) -> (Void))
    func cachedData(location: String) -> Data?
}
Run Code Online (Sandbox Code Playgroud)

通过示例实现:

    /// An implementation of DataServiceType protocol returning predefined results using arbitrary queue for asynchronyous mechanisms.
    /// Dedicated to be used in various tests (Unit Tests).
    class DataMockService: DataServiceType {

        var result      : DataFetchResult
        var async       : Bool = true
        var queue       : DispatchQueue = DispatchQueue.global(qos: .background)
        var cachedData  : Data? = nil

        init(result …
Run Code Online (Sandbox Code Playgroud)

closures swift swift3 xcode8-beta6

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

Xcode 6 Save for Enterprise Deployment不再为ipa创建plist了吗?

Xcode 5帮助创建了企业ipa的plist描述符.Xcode 6(6A313)仅创建ipa.这是一个错误还是故意改变?如果是这样的话 - 退后一步的原因是什么?

如果我之前没有使用Xcode 5生成plist,我需要自己手动创建它.你知道任何有助于这个过程的自动工具吗?

iphone enterprise ios xcode6

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

核心文本在iOS中计算字母框架

我需要为NSAttributedString(Core Text)中的每个字符(字形)计算精确的边界框.在整理了一些用于解决类似问题的代码(核心文本选择等)之后,结果非常好,但只有少数帧(红色)正在被正确计算:

在此输入图像描述

大多数帧都是水平或垂直错位(微小位).这是什么原因?我怎样才能完善这段代码?:

-(void)recalculate{

    // get characters from NSString
    NSUInteger len = [_attributedString.string length];
    UniChar *characters = (UniChar *)malloc(sizeof(UniChar)*len);
    CFStringGetCharacters((__bridge CFStringRef)_attributedString.string, CFRangeMake(0, [_attributedString.string length]), characters);

    // allocate glyphs and bounding box arrays for holding the result
    // assuming that each character is only one glyph, which is wrong
    CGGlyph *glyphs = (CGGlyph *)malloc(sizeof(CGGlyph)*len);
    CTFontGetGlyphsForCharacters(_font, characters, glyphs, len);

    // get bounding boxes for glyphs
    CTFontGetBoundingRectsForGlyphs(_font, kCTFontDefaultOrientation, glyphs, _characterFrames, len);
    free(characters); free(glyphs);

    // Measure how mush specec will be needed for this …
Run Code Online (Sandbox Code Playgroud)

glyph objective-c ipad core-text ios

53
推荐指数
1
解决办法
5608
查看次数

如何获得匹配正则表达式标准的最后一个Git标记

我需要Git命令来获取/找到以 'v' 开头的最后一个标签以获得最后一个版本控制提交(我在开头用v标签标记下一个应用程序版本(例如:v0.9.1beta).

有什么办法吗?

regex tags git tagging find

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

暂停后iPhone背景中的iPhone GPS永远不会恢复

我的应用程序需要在后台跟踪用户位置更改,并且只要用户移动就可以正常工作.当用户CLLocationManager在10-20分钟左右停止并暂停时.此通知表明:

-(void)locationManagerDidPauseLocationUpdates:(CLLocationManager *)manager{}
Run Code Online (Sandbox Code Playgroud)

这对我也没关系.太棒了,我节省了一些电池等

问题是CLLocationManager当用户再次开始移动时永远不会醒来,并且在我将应用程序放到前台之前永远不会触发委托方法(获取活动):

//Never called back after CLLocationManager pauses:
-(void)locationManagerDidResumeLocationUpdates:(CLLocationManager *)manager{}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{}
Run Code Online (Sandbox Code Playgroud)

为什么locationManagerDidResumeLocationUpdates在设备重新开始移动后从未调用过?GPS也不应自动恢复(因为自动暂停)? 有没有办法在没有用户互动的情况下恢复GPS?

应用程序在Info.plist文件中声明如下:

在此输入图像描述

我的CLLocationManager设置是:

locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager setActivityType:CLActivityTypeFitness];
//I WANT pauses to save some battery, etc... That is why following line is commented out (default)
 //[locationManager setPausesLocationUpdatesAutomatically:NO];
 locationManager.distanceFilter = kCLLocationAccuracyNearestTenMeters;
 locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
 [locationManager startUpdatingLocation];
Run Code Online (Sandbox Code Playgroud)

objective-c core-location uiapplicationdelegate cllocationmanager ios

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

Android Market - 此应用程序适用于超过0个设备?

我已经将apk发布到Android Market,为所有国家/地区免费激活和设置. 在此输入图像描述 Android Market说,我的应用程序与任何设备都不兼容.当我从PC浏览器访问Android Market时,我可以看到一个应用程序,但我无法从任何Android手机(用于在发布前测试应用程序的相同设备)下载它.

如果我的要求很少,那怎么可能呢?我已经在上传之前在一些相当旧的设备上测试了该应用程序并且它有效.

发布选项中的信息:

This application is only available to devices with these features, as defined in your application manifest.
Screen layouts: SMALL NORMAL LARGE XLARGE
Required device features
android.hardware.screen.portrait
android.hardware.touchscreen

*This application is available to over 0 devices.*
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

APK标签上的信息:

VersionCode: 2
VersionName: 1.0.1
Size: 4.3M
Localized to: default
Permissions: android.permission.READ_PHONE_STATE, android.permission.INTERNET, android.permission.WRITE_EXTERNAL_STORAGE, android.permission.ACCESS_NETWORK_STATE
Features: android.hardware.screen.portrait, android.hardware.touchscreen
API level: 7-15+
Supported screens: small-xlarge
OpenGL textures: all
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如果它不够奇怪,我在同一个帐户有另一个应用程序,具有非常相似的要求,它给了我:这个应用程序可用于超过746个设备. 在此输入图像描述 到底是怎么回事?

更新:

因为很多答案都表明:"只需激活你的APK ......"我再次强调: …

compatibility android device google-play

21
推荐指数
2
解决办法
9051
查看次数

如何在不使用MKMapView的情况下检查MKCoordinateRegion是否包含CLLocationCoordinate2D?

我需要检查用户位置是否属于MKCoordinateRegion.我很惊讶没有为此找到简单的功能,例如:CGRectContainsCGPoint(rect,point).

我找到了以下代码:

CLLocationCoordinate2D topLeftCoordinate = 
    CLLocationCoordinate2DMake(region.center.latitude 
                               + (region.span.latitudeDelta/2.0), 
                               region.center.longitude 
                               - (region.span.longitudeDelta/2.0));


    CLLocationCoordinate2D bottomRightCoordinate = 
    CLLocationCoordinate2DMake(region.center.latitude 
                               - (region.span.latitudeDelta/2.0), 
                               region.center.longitude 
                               + (region.span.longitudeDelta/2.0));

        if (location.latitude < topLeftCoordinate.latitude || location.latitude > bottomRightCoordinate.latitude || location.longitude < bottomRightCoordinate.longitude || location.longitude > bottomRightCoordinate.longitude) {

    // Coordinate fits into the region

    }
Run Code Online (Sandbox Code Playgroud)

但是,我不确定它是否准确,因为文档没有准确指定区域矩形的计算方式.

必须有更简单的方法来做到这一点.我是否忽略了MapKit框架文档中的某些功能?

iphone mkcoordinateregion cllocationmanager cllocation ios

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

无法在iOS6中将文本键入UITextField或UITextView

在我的应用程序之一,当我尝试编辑(键入一些文本)UITextField,UITextView或其他任何"文本能够" UIControl光标只是闪烁,但没有字符被输入了退格键除外(可能只有当我有它的一些初始文本)返回和切换字符类型.这涉及整个应用程序的所有控件.

摘要:

  1. 它仅在iOS 6.0中发生(在iOS 5.x上不会发生,4.x不在模拟器或真实设备上发生)
  2. 除了 shouldChangeCharactersInRange 之外,所有委托方法都被触发(shouldBeginEditing:didBeginEditing :) :
  3. isFirstResponder标志的行为设置正确(shouldBeginEditing:记录NO,而didBeginEditing:正确记录YES).它还使用第一个响应者已经编辑过的日志进行测试.
  4. 它自我修复后的任意UIAlertView呈现给用户,并驳回.如果此警报显示在同一屏幕(UIViewController视图)或任何其他屏幕上,则无关紧要.

我不知道如何处理或调试它.

我应该在哪里寻找提示?跟踪响应者链相关问题的任何专家等?

如何追踪UIAlertView问题对这个问题的影响?

iphone uitextfield uitextview first-responder ios6

19
推荐指数
1
解决办法
6936
查看次数

在iPhone模拟器中运行项目后,Xcode 4.6会定期挂起

我在iPhone模拟器Xcode 4.6中运行我的iPhone项目后,每隔2或3次在" 在iPhone 6.1模拟器中运行"阶段挂起.是的,经常这样.

它几乎挂在我运行的每个项目和我的2台Mac机器上(Mac Mini 8GB,Core 2 Duo,SSD驱动器和MacBook Pro Core 2 Duo 3,1 Ghz,8BG RAM,SSD驱动器)

这也是之前Xcode中的问题,但它很少发生,可以容忍.

我需要重新启动我的Xcode和模拟器才能再次运行项目(有时甚至重启OS X).

除了重新启动Xcode解决它之外,是什么导致了这个以及我们还能做些什么? 为什么Apple在这么长时间内无法解决这个问题?

更新:

我被告知这个问题是不具有建设性的,我不同意,因为我的主要问题是:

是什么导致这种常规挂起? 苹果为什么没有解决这么长时间,这不是我的主要兴趣所在.

主要关注点仍然非常实用和技术性:这种常规功能失调的共鸣是什么?开发人员可以手动做些什么来帮助它?

毕竟:Xcode只是我们在工作中使用的工具,每一项可以提高生产力的知识都是有价值的.

更新2:

**重新安装到最新的Mac OS X Lion(干净安装)并安装最新的Xcode,iTunes,Safari,iPhone模拟器问题仍然存在.**这显然是Xcode或iPhone模拟器的错误.

iphone xcode hang ios ios-simulator

19
推荐指数
1
解决办法
3974
查看次数