我正在尝试使用CLLocationManager我的iOS项目中的框架来访问用户的位置,但是当我打电话时
[locationManager startUpdatingLocation]
Run Code Online (Sandbox Code Playgroud)
既不locationManager:didUpdateLocations:或locationManager:didFailWithError:越来越调用.
//myViewController.h
@interface myViewController : UITableViewController <CLLocationManagerDelegate>
@end
//myViewController.m
@implementation myViewController{
CLLocationManager *locationManager;
}
//edit
- (void)viewDidLoad
{
[super viewDidLoad];
locationManager = [[CLLocationManager alloc] init];
}
//finish edit
-(void)getLocation
{
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error"
message:@"Failed to Get Your Location"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[errorAlert show];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *newLocation = …Run Code Online (Sandbox Code Playgroud) 我正在创建一个简单的媒体播放器应用.我的应用程序在播放第一个链接时崩溃,我点击了uitableview中的第二个链接.
- (void)viewDidLoad {
[super viewDidLoad];
arrURL = [NSArray arrayWithObjects: @"http://yp.shoutcast.com/sbin/tunein-station.pls?id=148820", @"http://www.kcrw.com/pls/kcrwmusic.pls",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=175821",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=148820",@"http://yp.shoutcast.com/sbin/tunein-station.pls?id=70931",nil];
url = [[NSURL alloc] init];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arrURL count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] ;
}
cell.textLabel.text = [arrURL objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
selectedSongIndex = indexPath.row;
url = [[NSURL alloc] initWithString:[arrURL objectAtIndex:indexPath.row]];
[self …Run Code Online (Sandbox Code Playgroud) 我已合并以下内容:
GoogleMaps/GoogleMaps.h以及GoogleMapsM4B/GoogleMaps.h文件Obj-CAppDelegate.swift (didFinishLaunchingWithOptions)方法中手动输入iOS API密钥.几乎所有其他人都建议的其他东西.我花了两天时间试图解决这个问题.有谁知道这个问题的解决方案?
控制台投诉是:
Run Code Online (Sandbox Code Playgroud)> "2015-08-17 18:02:19.899 Project[608:10014] ClientParametersRequest > failed, 3 attempts remaining (0 vs 6). Error > Domain=com.google.HTTPStatus Code=400 "The operation couldn’t be > completed. (com.google.HTTPStatus error 400.)" UserInfo=0x790bc050 > {data=<CFData 0x7925cb40 [0x22da9a8]>{length = 145, capacity = 256, > bytes = 0x3c48544d4c3e0a3c484541443e0a3c54 ... 3c2f48544d4c3e0a}} > 2015-08-17 18:02:19.899 randoPracty[608:10014] Google Maps SDK for iOS > (M4B) version: 1.10.17867.0 2015-08-17 18:02:19.959 > randoPracty[608:10014] …
我要回来了 UIImageView in - (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker;
这UIImageView将通过URL动态加载图像SDWebImage.
正如文档中描述的标记信息窗口:
注意:每次在地图上显示信息窗口时,信息窗口都会呈现为图像.这意味着在其属性处于活动状态时对其属性的任何更改都不会立即可见.信息窗口的内容将在下次显示时刷新.
关键是在下载图像后,信息窗口不刷新并继续显示占位符图像,直到用户隐藏然后再显示它.
所以我需要强制刷新markerInfoWindow下载的图像块中的内容.
我不能将iOS9修补程序的ipa提交到appstore,这是我在Application loader上得到的错误:
ERROR ITMS-90542:"无效的CFBundleSupportedPlatforms值.捆绑'Payload/PgapIos.app/GoogleMaps.bundle'中Info.plist文件中的'CFBundleSupportedPlatforms'键包含无效值'("iPhoneSimulator")'.考虑删除CFBundleSupportedPlatforms来自Info.plist的密钥.如果此捆绑包是第三方框架的一部分,请考虑联系框架的开发人员以获取更新以解决此问题."
ERROR ITMS-90535:"意外的CFBundleExecutable密钥.'Payload/PgapIos.app/GoogleMaps.bundle'中的捆绑包不包含捆绑可执行文件.如果此捆绑包故意不包含可执行文件,请考虑从其Info中删除CFBundleExecutable密钥. plist并使用BNDL的CFBundlePackageType.如果此捆绑包是第三方框架的一部分,请考虑联系框架的开发人员以获取更新以解决此问题."
我有xcode 7.0(7A220)
我创造了一个UIViewController我们可以打电话的人MyViewController1.当我打电话MyViewController1,我所有的IBOutletARE 零的viewDidLoad(以及其他代码太).
当我通过这样做创建这个控制器时
MyViewController1 *vc = [[MyViewController1 alloc] init],
MyViewController1例如MyViewController2,如果我替换另一个,它就可以了.所以我猜问题确实存在MyViewController1.
你可能想知道的最后一件事,就是MyViewController1实际上是一个子类,MySuperViewController1这是一个UIViewController.
谢谢你的帮助 !
编辑
我意识到我的情况可能更复杂.这是我的确切文件:
// MySuperViewController1
MySuperViewController1.h
MySuperViewController1.m
MySuperViewController1.xib
Run Code Online (Sandbox Code Playgroud)
// MyViewController1
MyViewController1.h
MyViewController1.m
Run Code Online (Sandbox Code Playgroud)
所以nib属于超类,而不是子类.我能这样做吗?
我正在使用NSURLConnection和NSURLRequest类从iOS(iPad/iPhone)向我的python google应用引擎服务器发送http请求.
如何读取响应的状态,即app引擎使用的值response.set_status(200, message="Success")?
NSURLConnection's connectionDidFinishLoading在客户端收到委托电话后,我无法找到可以读取这些状态代码的位置.
我有一个NSMutableArray (_theListOfAllQuestions)我正在填充文件中的数字.然后我比较了那个数组中的对象qNr (NSString),我得到了错误.我甚至铸造的阵列到另一个NSString,_checkQuestions,只是要确定我比较NSStrings.我测试使用项目进行比较.
-(void)read_A_Question:(NSString *)qNr {
NSLog(@"read_A_Question: %@", qNr);
int counter = 0;
for (NSString *item in _theListOfAllQuestions) {
NSLog(@"item: %@", item);
_checkQuestions = _theListOfAllQuestions[counter]; //_checkQuestion = NSString
NSLog(@"_checkQuestions: %@", _checkQuestions);
if ([_checkQuestions isEqualToString:qNr]) {
NSLog(@">>HIT<<");
exit(0); //Just for the testing
}
counter++;
}
Run Code Online (Sandbox Code Playgroud)
运行此代码时,我得到以下内容NSLog:
read_A_Question: 421
item: 1193
_checkQuestions: 1193
Run Code Online (Sandbox Code Playgroud)
......和错误:
- [__ NSCFNumber isEqualToString:]:无法识别的选择器发送到实例0x9246d80***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSCFNumber isEqualToString:]:无法识别的选择器发送到实例0x9246d80'
我相信,我还是比较NSString有一些某种但对我来说,它看起来像我比较NSString主场迎战NSString?
我真的需要一些帮助,1)了解问题,2)解决问题?
看起来我还没有完全理解块的概念......
在我的代码中,我必须asychronous block从' outer'方法中返回要返回的JSON数据.我variable with __block用谷歌搜索,发现如果定义一个,_mutability_ of那么变量就被扩展到了变量v̶i̶s̶i̶b̶i̶l̶i̶t̶y̶ block.
但由于某种原因,返回的json对象是nil.我想知道为什么?
- (NSMutableDictionary *)executeRequestUrlString:(NSString *)urlString
{
__block NSMutableDictionary *json = nil;
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPShouldHandleCookies:YES];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-type"];
NSString *cookieString = [self.userDefaults objectForKey:SAVED_COOKIE];
[request addValue:cookieString forHTTPHeaderField:@"Cookie"];
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue currentQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
NSLog(@"dataAsString %@", [NSString stringWithUTF8String:[data bytes]]);
NSError *error1;
NSMutableDictionary * innerJson = [NSJSONSerialization
JSONObjectWithData:data
options:kNilOptions
error:&error1];
json = …Run Code Online (Sandbox Code Playgroud) 我正在使用Xcode 5.0.2并在尝试编译我的目标C代码时收到以下警告:
从枚举类型'enum UIDeviceOrientation'到不同的枚举类型'UIInterfaceOrientation'(又名'enum UIInterfaceOrientation')的隐式转换
警告在viewController.m中
-(void)youTubeStarted:(NSNotification *)notification{
// your code here
NSLog(@"youTubeStarted");
**[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO];**
}
-(void)youTubeFinished:(NSNotification *)notification{
// your code here
NSLog(@"youTubeFinished");
}
- (void)youTubeVideoExit:(id)sender {
**[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:NO];**
}
Run Code Online (Sandbox Code Playgroud) ios ×7
objective-c ×6
xcode ×3
gmsmapview ×2
avplayer ×1
avplayeritem ×1
google-maps ×1
iboutlet ×1
ios9 ×1
iphone ×1
swift ×1