0
Objective sharpie를 사용하여 바인딩하는 데 몇 가지 문제가 있습니다. Xamarin.ios와 함께 IndoorAtlas
iOS native sdk를 바인딩합니다.Objective Sharpie 프로토콜을 사용하여 바인딩 한 후 xamarin.iOS에서 메소드가 호출되지 않습니다.
Protocols 메서드가 호출되지 않는 것처럼 구현하는 동안 문제가 발생합니다. 특별한 방식으로 처리해야합니까?
API 정의 파일과 구현 파일을 첨부하고 있습니다.
// @protocol IALocationManagerDelegate
[Protocol, Model]
[BaseType(typeof(NSObject))]
interface IALocationManagerDelegate
{
// @optional -(void)indoorLocationManager:(IALocationManager *
_Nonnull)manager didUpdateLocations:(NSArray * _Nonnull)locations;
[Export("indoorLocationManager:didUpdateLocations:")]
void DidUpdateLocations(IALocationManager manager, IALocation[] locations);
// @optional -(void)indoorLocationManager:(IALocationManager *
_Nonnull)manager didEnterRegion:(IARegion * _Nonnull)region;
[Export("indoorLocationManager:didEnterRegion:")]
void DidEnterRegion(IALocationManager manager, IARegion region);
}
// @interface IALocationManager : NSObject
[BaseType(typeof(NSObject))]
interface IALocationManager
{
[Wrap("WeakDelegate")]
[NullAllowed]
IALocationManagerDelegate Delegate { get; set; }
// @property (readwrite, nonatomic, weak) id<IALocationManagerDelegate>
_Nullable delegate;
[NullAllowed, Export("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }
}
////의 ViewController --Calling 위임 방법
[Export("indoorLocationManager:didUpdateLocations:")]
public void DidUpdateLocations(IALocationManager manager , IALocation[] locations)
{
IALocation loc = locations[locations.Length - 1];
if (mFloorPlan != null)
{
CoreGraphics.CGPoint cg = mFloorPlan.CoordinateToPoint(loc.Location.Coordinate);
this.map.Center = cg;
}
}
[Export("indoorLocationManager:didEnterRegion:")]
public void DidEnterRegion(IALocationManager manager, IARegion region)
{
if (region.Type != ia_region_type.FloorPlan)
Console.WriteLine("Region Changed to {0} " + region.Identifier);
else
{
FetchFloorPlan();
}
}
1. 바인딩 프로젝트가 성공적으로 빌드 되었습니까? 2. 약 게이트를 사용하는 것 같아요, 맞습니까? –
@ColeXia 예 바인딩 프로젝트가 오류나 문제없이 잘 구축되고 있습니다. 약한 대리인을 사용 중이며 API 정의가 약합니다. – nikheel
현재 뷰 컨트롤러를 약한 대리인에게 할당 했습니까, 'IALocationManager.WeakDelegate = this' –