我正在进行UI单元测试,并且几天后UI单元测试拒绝正常启动.我设置了一个简单的测试来点击一个按钮,当我运行它时,它会在启动测试之前挂起启动应用程序.
注意,它总是挂起一分钟,然后正确地进行测试.
如果我从模拟器设备中删除应用程序,或清除整个模拟器的内容和设置,则测试会在第一次运行时立即成功运行.它每次都会挂起,直到我再次删除.这也不是很好,因为我最终每次都会收到新的位置批准提示,这可能会干扰应用程序.
这里发生了什么?
t = 0.00s Start Test
t = 0.00s Set Up
t = 0.00s Launch com.domain.appName
2015-10-06 11:59:24.493 XCTRunner[66707:4085844] Continuing to run tests in the background with task ID 1
t = 0.92s Waiting for accessibility to load
t = 60.92s Wait for app to idle
... rest of test runs immediately
Run Code Online (Sandbox Code Playgroud) 我使用IOS 8和Google AdMob在Xcode 6中编写了我的应用程序,该工具运行正常.现在在Xcode 7中我收到来自谷歌的消息, Advertising tracking may be disabled. To get test ads on this device, enable advertising tracking.可能是因为-canOpenURL错误?(-canOpenURL: failed for URL: "kindle://home" - error: "This app is not allowed to query for scheme kindle")
这是我的视口元标记:
<meta name="viewport" content="user-scalable=no, initial-scale = 1, minimum-scale = 1, maximum-scale = 1, width=device-width">
Run Code Online (Sandbox Code Playgroud)
在Safari的iOS 8,window.innerHeight和$(window).height()在iPad 928:两者返回相同的值.
但是在Safari iOS 9上,window.innerHeight并且$(window).height()在运行iOS 9.0或1154的iPhone 6s和运行iOS 9.1的iPad mini上分别返回1461和559的不同值.
这是Safari中的错误还是打算?1461在我的iPhone上来自哪里?我应该使用$(window).height()(返回我想要的值)而不是window.innerHeight?
我使用iOS9和Xcode7遇到了Facebook SDK 4.6的问题.
在设备上进行测试时,单击登录按钮时没有任何反应,在iOS模拟器中,我收到错误.
2015-10-01 17:12:32.197 TestProject[32112:797172] -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
Run Code Online (Sandbox Code Playgroud)
在我的plist文件中,我包括以下内容
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth</string>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb{FACEBOOK_APP_ID}</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>{FACEBOOK_APP_ID}</string>
<key>FacebookDisplayName</key>
<string>{Your App Name}</string>
Run Code Online (Sandbox Code Playgroud) 我是 swift 2.1 的新手,我为字符串创建了一个扩展,函数名称是join,当我将代码从 swift 2.0 转换为 swift 2.1 时,我的代码返回错误请帮助我,我无法理解该怎么做
这是扩展
extension String {
func join<S : SequenceType where S.Generator.Element : Printable>(elements: S) -> String {
return self.join(map(elements){ $0.description })
}
}
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的
var channel_string:String!
var languages = [String]()
for var i = 0 ; i < ary_selected_channel.count ; i++
{
let getString_setvalue = ary_selected_channel.objectAtIndex(i) as! String
languages.append(getString_setvalue)
}
channel_string = " ".join(languages)
Run Code Online (Sandbox Code Playgroud)
输出看起来像,假设在数组中我有三个名称 [“一”,“二”,“三”] 然后输出是
channel_string = "one two three"
Run Code Online (Sandbox Code Playgroud)
错误是 1) Printable 已重命名为 customstringconv 2)表达式类型不明确,没有更多上下文
我已经使用发行配置文件对代码进行签名,但是当我在XCode 5.1(为企业/临时部署保存)中生成ipa时,该应用程序未安装在我的设备中。我已经检查了分发配置文件是否与Macbook中安装的生产证书正确对齐。有什么原因或解决方案,以便我可以安装我的应用程序?谢谢!
我想从主机下载一些项目,但现在收到警告: 'connectionWithRequest:delegate:'is deprecated in iOS9.0 - Use NSURLSession'
我到处搜索,但不幸的是我找不到任何解决方案。
你能帮助我吗?
我的代码如下所示:
- (void)downloadItems
{
// Download the json file
NSURL *jsonFileUrl = [NSURL URLWithString:@"http://myhost.com/test.php"];
// Create the request
NSURLRequest *urlRequest = [[NSURLRequest alloc] initWithURL:jsonFileUrl];
// Create the NSURLConnection
[NSURLConnection connectionWithRequest:urlRequest delegate:self];
}
#pragma mark NSURLConnectionDataProtocol Methods
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
// Initialize the data object
_downloadedData = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
// Append the newly downloaded data
[_downloadedData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection …Run Code Online (Sandbox Code Playgroud) 我有几个图像存储在我的中Images.xcassets,我通过代码和接口Buider加载.然而,iOS 9更新打破了一切:从代码或IB加载时图像都没有显示.
一切都工作得很好,除了图像不再加载.
说我有一个以Image我的名字命名的图像.xcassets.在iOS 8上
[UIImage imageNamed:@"Image"]
Run Code Online (Sandbox Code Playgroud)
返回一个有效的指针,但它nil在iOS 9上返回.在Interface Builder中也是如此:UIImageView从IB设置的所有内容都是空的.
但有两个例外:两个小(48x48)图像确实正确加载.我注意到它们都被编译进去Assets.car,所有其他的都是作为pngs和jpeg坐在主目录中......但配置与所有图像相同.
iOS 8上不存在此问题.
有任何想法吗 ?
更新到Xcode 7.1后,我的所有苹果ID都被删除了.当我尝试在偏好中添加帐户时,我面临无限加载指示.我尝试了几个帐户,但没有一个工作.有什么可能导致这个的线索?
我有一个json NSString和NSDate数据(dob)我创建NSDictionary它,但当我使用代码将其转换为数据
NSData *requestData1 = [NSJSONSerialization dataWithJSONObject:json_inputDic options:0 error:&error];
Run Code Online (Sandbox Code Playgroud)
通过给出错误来杀死它
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSDate)'
Run Code Online (Sandbox Code Playgroud)
我的问题是我需要传递dob,因为NSDate是强制性的.我如何解决它?
例如
NSDate *newDate = [NSDate date];
[dic setValue:newDate forKey:@"dob"];
NSString *good = @"good";
[dic setValue:good forKey:@"good"];
NSLog(@"dic=%@",dic);
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&error]; //it gives error
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"jsonData as string:\n%@", jsonString);
Run Code Online (Sandbox Code Playgroud) ios ×10
ios9 ×5
xcode ×4
xcode7 ×3
json ×2
objective-c ×2
facebook ×1
ipa ×1
iphone ×1
javascript ×1
jquery ×1
nsdate ×1
nsdictionary ×1
nsurlsession ×1
provisioning ×1
safari ×1
string ×1
swift ×1
swift2 ×1
unit-testing ×1
xcasset ×1
xcode5.1 ×1
xcode7.1 ×1