标记值是整数:
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:addressField forState:UIControlStateNormal];
[button addTarget:self action:@selector(pickTheQuiz:) forControlEvents:UIControlEventTouchUpInside];
button.tag=1;//or what other integer value, i need to put a string value
Run Code Online (Sandbox Code Playgroud)
在接收方法中:
-(void)pickTheQuiz:(id)sender{
NSLog(@"The part number is:%i",((UIControl*)sender).tag);//i need to receive a string value instead of numeric value
}
Run Code Online (Sandbox Code Playgroud) 我正在使用自定义UITableViewCell.当我尝试运行我的代码时,我得到了这个异常堆栈,我无法理解问题的根源:
terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'invalid nib registered for identifier ((null)) - nib must contain exactly one top level object which must be a UITableViewCell instance'
Run Code Online (Sandbox Code Playgroud)
请注意我没有使用Storyboard.
编辑:
这是我根据断点导致问题的相关代码:
[tableviewSupport registerNib:[UINib nibWithNibName:@"HotelCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:CustomCellCId];
Run Code Online (Sandbox Code Playgroud) 当我尝试为我的应用程序制作存档时,我成功了,但有一个奇怪的警告:
warning: Application failed codesign verification. The signature was invalid, contains disallowed entitlements, or it was not signed with an iPhone Distribution Certificate. (-19011)
Executable=/Users/Malek/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-elmujlurzvtkqdctznqivfpchsfq/Build/Intermediates/ArchiveIntermediates/Fontenay-sous-Bois/InstallationBuildProductsLocation/Applications/Fontenay-sous-Bois.app/Fontenay-sous-Bois
AssertMacros: message, file: /SourceCache/codesign_wrapper_Sim/Security-1245/codesign_wrapper/codesign_wrapper.c, line: 495
AssertMacros: profile, file: /SourceCache/codesign_wrapper_Sim/Security-1245/codesign_wrapper/codesign_wrapper.c, line: 904
codesign_wrapper-0.7.10: Failed to load provision profile from: /Users/Malek/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-elmujlurzvtkqdctznqivfpchsfq/Build/Intermediates/ArchiveIntermediates/Fontenay-sous-Bois/InstallationBuildProductsLocation/Applications/Fontenay-sous-Bois.app/embedded.mobileprovisi
- (null)
Run Code Online (Sandbox Code Playgroud)
当我使用Xcode 4.2时,一切都很好,但自从我升级到Xcode 4.3后,我一直看到这个警告,请帮忙:)
这让我发疯,当我尝试在模拟器上编译时,一切都很好,但在设备上我得到了这个错误:
ld: library not found for -lz
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
请帮我理解问题的根源:
Ld /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois normal armv7
cd /Users/ZConsulting/Desktop/Fontenay-sous-Bois
setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products
/Debug-iphoneos -F/Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
/iPhoneOS5.0.sdk/Developer/Library/Frameworks -filelist /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Intermediates/Fontenay-sous-Bois.build/Debug-iphoneos/Fontenay-sous-Bois.build/Objects-normal/armv7/Fontenay-sous-Bois.LinkFileList -dead_strip -fobjc-arc -miphoneos-version-min=5.0 -framework SenTestingKit -lz -lz.1.1.3 -framework MobileCoreServices
-framework SystemConfiguration -framework CFNetwork -framework CoreLocation -framework MapKit -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/ZConsulting/Library/Developer/Xcode/DerivedData/Fontenay-sous-Bois-dhlecgdgtoldsadoctkyueriyius/Build/Products/Debug-iphoneos/Fontenay-sous-Bois.app/Fontenay-sous-Bois
Run Code Online (Sandbox Code Playgroud)
编辑:
我确实导入了libz.1.1.3.dylib框架:

我在Linked框架中获得的唯一libz就是 libz.1.1.3.dylib

当我尝试更改.hand 中的视图控制器名称时.m,出现此错误:
Lexical or PreProcessor Issue
'MyViewController.h' file not found.
Run Code Online (Sandbox Code Playgroud)
仅供参考,尽管此词法错误,应用程序仍能正常运行。
我尝试在我的客户端设备中运行一个HelloWorld项目,Xcode中的应用程序标识符是:com.domainname.HelloWorld,当我创建配置文件时,在AppID中,我推了:( com.domainname.helloworld小写).
现在,在Xcode中,我尝试将代码签名标识分配给我创建的配置文件,但是,在下拉列表中,我可以看到配置文件但我无法选择它.

我正在学习这个教程 ,我怀疑我不知道该怎么做Don’t forget to add the new provisioning profile to XCode as well.
你能帮我吗?提前.
我在我的iPhone应用程序上使用SQLite数据库,我需要执行需要嵌套查询的任务.但是,我的查询似乎不起作用,我用谷歌搜索它,我发现SQLite不支持Subquerys.有什么解决方案吗?
编辑: 这是对我不起作用的查询:
select count(*) from quiz where theme=(select id from theme where nom="Houses") and etat=0;
Run Code Online (Sandbox Code Playgroud) 注释在地图上显示正常,但是当我点击一个时,我会引发此异常:
[NSNull length]: unrecognized selector sent to instance
'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
我的相关代码是这样的:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
static NSString *identifier = @"MyLocation";
if ([annotation isKindOfClass:[MyLocation class]]) {
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [mapView2 dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
} else {
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
annotationView.pinColor = MKPinAnnotationColorRed;
return annotationView;
}
return nil;
}
Run Code Online (Sandbox Code Playgroud)
并配置注释:
NSNumber * latitude = …Run Code Online (Sandbox Code Playgroud) 我想将两个常规数组绑定到一个关联数组中.第一个的值是键,第二个的值是元素.
var array1=new Array("key1","Key2","Key3");
var array2=new Array("Value1","Value2","Value3");
var associative_array=new Array();
for(var i=0;i<3;i++){
associative_array[array1[i]]=array2[i];
}
Run Code Online (Sandbox Code Playgroud)
但是当我试图获得新的关联数组的长度时,我注意到它是空的:
alert(associative_array.length);//always 0
Run Code Online (Sandbox Code Playgroud)
我做错了什么?Thanx提前.
我有一个像这样声明的NSString:
.H:
@interface ViewController : UIViewController
{
NSString * aString;
}
@property(nonatomic,copy)NSString *aString;
Run Code Online (Sandbox Code Playgroud)
.m:
@synthesize aString;
......
aString=[[NSString alloc]init];
aString=@"Hello World";
NSLog(@"%@",aString);//The app crashes here
Run Code Online (Sandbox Code Playgroud)
应用程序崩溃与此堆栈跟踪:
-[CFString respondsToSelector:]: message sent to deallocated instance
Run Code Online (Sandbox Code Playgroud) ios ×8
objective-c ×6
xcode4.2 ×2
xcode4.3 ×2
foundation ×1
javascript ×1
mkannotation ×1
sqlite ×1
uitableview ×1