我创建MonoTouch的绑定到Quickblox聊天服务。 我成功地做这在以前版本(1.9.x的),但在2.0.2库,其获得新的结合启动设备上的问题。 它启动在模拟器罚款。 猜测它是连接标志有问题,但已经江郎才尽。
结合项目编译罚款。 该DLL创建,我可以在我的主机项目中引用它。 运行在模拟器主体项目工作正常。 在实际的设备,应用程序启动,但进程崩溃让过去黑屏之前。 在Xamarin工作室“应用程序输出”窗口无输出。 没什么。 什么办法可以插入一些调试信息弄清楚是怎么回事了?
Quickblox提供了以下设置在iOS样本项目:
其它链接器标记:-lstdc ++ -ObjC -lxml2
链接二进制与图书馆:
libxml2.2.dylib libresolv.9.dylib libz.1.2.5.dylib
AVFoundation.framework CoreVideo.framework Quickblox.framework Accelerate.framework CoreMedia.framework AudioToolbox.framework CoreLocation.framework CoreDate.framework CoreGraphics.framework MobileCoreServices.framework SystemConfiguration.framework CFNetwork.framework UIKit.framework Foundation.framework
这里是我结合我的项目“linkwith.cs”文件:
using System;
using MonoTouch.ObjCRuntime;
[assembly: LinkWith ("libQuickblox.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CFNetwork SystemConfiguration MobileCoreServices CoreGraphics CoreLocation CoreData AudioToolbox CoreMedia Accelerate CoreVideo AVFoundation Security", LinkerFlags = "-lxml2 -lz -lresolv -ObjC -lstdc++")]
我已经试过这两个iPhone 5的设备,无论是运行iOS 7.1
如果我注释掉绑定这个特殊类(QBRequest.h),该项目将启动设备上。 它告诉我有什么用绑定到特定的类。 那类从NSObject的继承,并没有导入任何其他库,因此没有引发任何明显的担忧。
#import <Foundation/Foundation.h>
@class QBRequest;
@class QBResponse;
@class QBRequestStatus;
@protocol QBResponseSerialisationProtocol;
@protocol QBRequestSerialisationProtocol;
@class QBHTTPRequestSerialiser;
extern const struct QBRequestMethod {
__unsafe_unretained NSString *POST;
__unsafe_unretained NSString *GET;
__unsafe_unretained NSString *HEAD;
__unsafe_unretained NSString *PUT;
__unsafe_unretained NSString *DELETE;
} QBRequestMethod;
typedef void (^QBRequestStatusUpdateBlock)(QBRequest *request, QBRequestStatus *status);
typedef void (^QBRequestCompletionBlock)(QBRequest *request, QBResponse *response, NSDictionary *objects);
typedef void (^QBRequestErrorBlock)(QBResponse *response);
@interface QBRequest : NSObject
@property (nonatomic, getter=isCancelled, readonly) BOOL canceled;
@property (nonatomic, copy) QBRequestCompletionBlock completionBlock;
@property (nonatomic, copy) QBRequestStatusUpdateBlock updateBlock;
@property (nonatomic, strong) QBHTTPRequestSerialiser<QBRequestSerialisationProtocol> *requestSerialisator;
// QBHTTPResponseSerialiser<QBResponseSerialisationProtocol>
@property (nonatomic, strong) NSArray *responseSerialisators;
@property (nonatomic, copy) NSDictionary *headers;
@property (nonatomic, copy) NSDictionary *parameters;
@property (nonatomic, copy) NSData *body;
@property (nonatomic) NSStringEncoding encoding;
- (instancetype)initWithCompletionBlock:(QBRequestCompletionBlock)completionBlock;
- (instancetype)initWithUpdateBlock:(QBRequestStatusUpdateBlock)updateBlock completionBlock:(QBRequestCompletionBlock)completionBlock;
- (void)cancel;
@end
在我ApiDefinition.cs文件中的绑定条目是这样的:
[BaseType (typeof (NSObject))]
public partial interface QBRequest {
[Export ("canceled")]
bool Canceled { [Bind ("isCancelled")] get; }
[Export ("completionBlock", ArgumentSemantic.Copy)]
RequestCompletionDelegate CompletionBlock { get; set; }
[Export ("updateBlock", ArgumentSemantic.Copy)]
RequestCompletionDelegate UpdateBlock { get; set; }
[Export ("headers", ArgumentSemantic.Copy)]
NSDictionary Headers { get; set; }
[Export ("parameters", ArgumentSemantic.Copy)]
NSDictionary Parameters { get; set; }
[Export ("body", ArgumentSemantic.Copy)]
NSData Body { get; set; }
[Export ("encoding")]
NSStringEncoding Encoding { get; set; }
[Export ("initWithCompletionBlock:")]
IntPtr CreateWithCompletionDelegate (RequestCompletionDelegate completionBlock);
[Export ("initWithUpdateBlock:completionBlock:")]
IntPtr CreateWithStatusUpdateDelegate (RequestStatusUpdateDelegate updateBlock, RequestCompletionDelegate completionBlock);
[Export ("cancel")]
void Cancel ();
}
感谢您的想法!